From 417924294b856c7beb34619a8711c69f69a107e6 Mon Sep 17 00:00:00 2001 From: zYne Date: Sun, 26 Nov 2006 19:48:55 +0000 Subject: [PATCH] Updated datadict drivers --- lib/Doctrine/DataDict/Firebird.php | 2 +- lib/Doctrine/DataDict/Mssql.php | 2 +- lib/Doctrine/DataDict/Mysql.php | 9 +++++---- lib/Doctrine/DataDict/Oracle.php | 18 +++++++++--------- lib/Doctrine/DataDict/Pgsql.php | 2 +- lib/Doctrine/DataDict/Sqlite.php | 18 ++++++++++-------- 6 files changed, 27 insertions(+), 24 deletions(-) diff --git a/lib/Doctrine/DataDict/Firebird.php b/lib/Doctrine/DataDict/Firebird.php index 3d2874be2..b1e9826d0 100644 --- a/lib/Doctrine/DataDict/Firebird.php +++ b/lib/Doctrine/DataDict/Firebird.php @@ -30,7 +30,7 @@ Doctrine::autoload('Doctrine_DataDict'); * @link www.phpdoctrine.com * @since 1.0 */ -class Doctrine_DataDict_Firebird extends Doctrine_DataDict { +class Doctrine_DataDict_Firebird extends Doctrine_Connection_Module { /** * Obtain DBMS specific SQL code portion needed to declare an text type * field to be used in statements like CREATE TABLE. diff --git a/lib/Doctrine/DataDict/Mssql.php b/lib/Doctrine/DataDict/Mssql.php index 101a96a43..5033c48ea 100644 --- a/lib/Doctrine/DataDict/Mssql.php +++ b/lib/Doctrine/DataDict/Mssql.php @@ -30,7 +30,7 @@ * @link www.phpdoctrine.com * @since 1.0 */ -class Doctrine_DataDict_Mssql extends Doctrine_DataDict { +class Doctrine_DataDict_Mssql extends Doctrine_Connection_Module { /** * Obtain DBMS specific SQL code portion needed to declare an text type * field to be used in statements like CREATE TABLE. diff --git a/lib/Doctrine/DataDict/Mysql.php b/lib/Doctrine/DataDict/Mysql.php index b51d725f9..ff57303db 100644 --- a/lib/Doctrine/DataDict/Mysql.php +++ b/lib/Doctrine/DataDict/Mysql.php @@ -53,7 +53,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict { * @return string DBMS specific SQL code portion that should be used to * declare the specified field. */ - public function getTypeDeclaration($field) { + public function getNativeDeclaration($field) { switch ($field['type']) { case 'array': case 'object': @@ -127,10 +127,9 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict { * Maps a native array description of a field to a MDB2 datatype and length * * @param array $field native field description - * @author Lukas Smith (PEAR MDB2 library) * @return array containing the various possible types, length, sign, fixed */ - public function mapNativeDatatype($field) { + public function getDoctrineDeclaration($field) { $db_type = strtolower($field['type']); $db_type = strtok($db_type, '(), '); if ($db_type == 'national') { @@ -328,8 +327,10 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict { $notnull = empty($field['notnull']) ? '' : ' NOT NULL'; $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED'; + $name = $this->conn->quoteIdentifier($name, true); - return $name . ' ' . $this->getTypeDeclaration($field) . $unsigned . $default . $notnull . $autoinc; + + return $name . ' ' . $this->getNativeDeclaration($field) . $unsigned . $default . $notnull . $autoinc; } /** * lists all databases diff --git a/lib/Doctrine/DataDict/Oracle.php b/lib/Doctrine/DataDict/Oracle.php index 831c05536..02527169f 100644 --- a/lib/Doctrine/DataDict/Oracle.php +++ b/lib/Doctrine/DataDict/Oracle.php @@ -19,14 +19,14 @@ * . */ /** - * @package Doctrine - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @author Konsta Vesterinen - * @version $Revision$ - * @category Object Relational Mapping - * @link www.phpdoctrine.com - * @since 1.0 - */ + * @package Doctrine + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @author Konsta Vesterinen + * @version $Revision$ + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + */ class Doctrine_DataDict_Oracle extends Doctrine_DataDict { /** * Obtain DBMS specific SQL code portion needed to declare an text type @@ -158,7 +158,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict { case 'bfile': $type[] = 'blob'; $length = null; - break; + break; case 'rowid': case 'urowid': default: diff --git a/lib/Doctrine/DataDict/Pgsql.php b/lib/Doctrine/DataDict/Pgsql.php index 78a06ee84..540b9154e 100644 --- a/lib/Doctrine/DataDict/Pgsql.php +++ b/lib/Doctrine/DataDict/Pgsql.php @@ -29,7 +29,7 @@ * @link www.phpdoctrine.com * @since 1.0 */ -class Doctrine_DataDict_Pgsql extends Doctrine_DataDict { +class Doctrine_DataDict_Pgsql extends Doctrine_Connection_Module { /** * @param array $reservedKeyWords an array of reserved keywords by pgsql */ diff --git a/lib/Doctrine/DataDict/Sqlite.php b/lib/Doctrine/DataDict/Sqlite.php index 0b6fd55f3..630606de2 100644 --- a/lib/Doctrine/DataDict/Sqlite.php +++ b/lib/Doctrine/DataDict/Sqlite.php @@ -29,7 +29,7 @@ Doctrine::autoload('Doctrine_DataDict'); * @link www.phpdoctrine.com * @since 1.0 */ -class Doctrine_DataDict_Sqlite extends Doctrine_DataDict { +class Doctrine_DataDict_Sqlite extends Doctrine_Connection_Module { /** * Obtain DBMS specific SQL code portion needed to declare an text type * field to be used in statements like CREATE TABLE. @@ -184,36 +184,38 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict { if ($fixed !== false) { $fixed = true; } - break; + break; case 'date': $type[] = 'date'; $length = null; - break; + break; case 'datetime': case 'timestamp': $type[] = 'timestamp'; $length = null; - break; + break; case 'time': $type[] = 'time'; $length = null; - break; + break; case 'float': case 'double': case 'real': $type[] = 'float'; - break; + $length = null; + break; case 'decimal': case 'numeric': $type[] = 'decimal'; - break; + $length = null; + break; case 'tinyblob': case 'mediumblob': case 'longblob': case 'blob': $type[] = 'blob'; $length = null; - break; + break; case 'year': $type[] = 'integer'; $type[] = 'date';