cvs: pear /MDB2/MDB2/Driver/Datatype mssql.php
| From: | Lorenzo Alberton | Date: | Thu, 01 Mar 2007 14:22:02 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Datatype mssql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44924@lists.php.net to get a copy of this message | ||
quipo Thu Mar 1 14:22:02 2007 UTC
Modified files:
/pear/MDB2/MDB2/Driver/Datatype mssql.php
Log:
renamed _getDeclaration() to _getDeclarationOptions(), to comply with the latest refactoring of
MDB_Driver_Datatype_Common, and added charset and collation support
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/mssql.php?r1=1.50&r2=1.51&diff_format=u
Index: pear/MDB2/MDB2/Driver/Datatype/mssql.php
diff -u pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.50 pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.51
--- pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.50 Thu Mar 1 11:25:34 2007
+++ pear/MDB2/MDB2/Driver/Datatype/mssql.php Thu Mar 1 14:22:01 2007
@@ -44,7 +44,7 @@
// | Daniel Convissor <danielc@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: mssql.php,v 1.50 2007/03/01 11:25:34 quipo Exp $
+// $Id: mssql.php,v 1.51 2007/03/01 14:22:01 quipo Exp $
//
require_once 'MDB2/Driver/Datatype/Common.php';
@@ -170,7 +170,7 @@
// {{{ _getDeclaration()
/**
-+ * Obtain DBMS specific SQL code portion needed to declare a generic type
+ * Obtain DBMS specific SQL code portion needed to declare a generic type
* field to be used in statements like CREATE TABLE.
*
* @param string $name name the field to be declared.
@@ -193,12 +193,10 @@
* declare the specified field.
* @access protected
*/
- function _getDeclaration($name, $field)
+ function _getDeclarationOptions($field)
{
- $db =& $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
+ $charset = empty($field['charset']) ? '' :
+ ' '.$this->_getCharsetFieldDeclaration($field['charset']);
$default = '';
if (array_key_exists('default', $field)) {
@@ -217,8 +215,10 @@
}
$notnull = empty($field['notnull']) ? ' NULL' : ' NOT NULL';
- $name = $db->quoteIdentifier($name, true);
- return $name.' '.$this->getTypeDeclaration($field).$default.$notnull;
+
+ $collation = empty($field['collation']) ? '' :
+ ' '.$this->_getCollationFieldDeclaration($field['collation']);
+ return $charset.$default.$notnull.$collation;
}
// }}}