Updated datadict drivers
This commit is contained in:
parent
eb6dde75e6
commit
417924294b
@ -30,7 +30,7 @@ Doctrine::autoload('Doctrine_DataDict');
|
|||||||
* @link www.phpdoctrine.com
|
* @link www.phpdoctrine.com
|
||||||
* @since 1.0
|
* @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
|
* Obtain DBMS specific SQL code portion needed to declare an text type
|
||||||
* field to be used in statements like CREATE TABLE.
|
* field to be used in statements like CREATE TABLE.
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
* @link www.phpdoctrine.com
|
* @link www.phpdoctrine.com
|
||||||
* @since 1.0
|
* @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
|
* Obtain DBMS specific SQL code portion needed to declare an text type
|
||||||
* field to be used in statements like CREATE TABLE.
|
* field to be used in statements like CREATE TABLE.
|
||||||
|
@ -53,7 +53,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict {
|
|||||||
* @return string DBMS specific SQL code portion that should be used to
|
* @return string DBMS specific SQL code portion that should be used to
|
||||||
* declare the specified field.
|
* declare the specified field.
|
||||||
*/
|
*/
|
||||||
public function getTypeDeclaration($field) {
|
public function getNativeDeclaration($field) {
|
||||||
switch ($field['type']) {
|
switch ($field['type']) {
|
||||||
case 'array':
|
case 'array':
|
||||||
case 'object':
|
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
|
* Maps a native array description of a field to a MDB2 datatype and length
|
||||||
*
|
*
|
||||||
* @param array $field native field description
|
* @param array $field native field description
|
||||||
* @author Lukas Smith (PEAR MDB2 library)
|
|
||||||
* @return array containing the various possible types, length, sign, fixed
|
* @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 = strtolower($field['type']);
|
||||||
$db_type = strtok($db_type, '(), ');
|
$db_type = strtok($db_type, '(), ');
|
||||||
if ($db_type == 'national') {
|
if ($db_type == 'national') {
|
||||||
@ -328,8 +327,10 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict {
|
|||||||
|
|
||||||
$notnull = empty($field['notnull']) ? '' : ' NOT NULL';
|
$notnull = empty($field['notnull']) ? '' : ' NOT NULL';
|
||||||
$unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
|
$unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
|
||||||
|
|
||||||
$name = $this->conn->quoteIdentifier($name, true);
|
$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
|
* lists all databases
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
* <http://www.phpdoctrine.com>.
|
* <http://www.phpdoctrine.com>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @package Doctrine
|
* @package Doctrine
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @category Object Relational Mapping
|
* @category Object Relational Mapping
|
||||||
* @link www.phpdoctrine.com
|
* @link www.phpdoctrine.com
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class Doctrine_DataDict_Oracle extends Doctrine_DataDict {
|
class Doctrine_DataDict_Oracle extends Doctrine_DataDict {
|
||||||
/**
|
/**
|
||||||
* Obtain DBMS specific SQL code portion needed to declare an text type
|
* 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':
|
case 'bfile':
|
||||||
$type[] = 'blob';
|
$type[] = 'blob';
|
||||||
$length = null;
|
$length = null;
|
||||||
break;
|
break;
|
||||||
case 'rowid':
|
case 'rowid':
|
||||||
case 'urowid':
|
case 'urowid':
|
||||||
default:
|
default:
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* @link www.phpdoctrine.com
|
* @link www.phpdoctrine.com
|
||||||
* @since 1.0
|
* @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
|
* @param array $reservedKeyWords an array of reserved keywords by pgsql
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +29,7 @@ Doctrine::autoload('Doctrine_DataDict');
|
|||||||
* @link www.phpdoctrine.com
|
* @link www.phpdoctrine.com
|
||||||
* @since 1.0
|
* @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
|
* Obtain DBMS specific SQL code portion needed to declare an text type
|
||||||
* field to be used in statements like CREATE TABLE.
|
* field to be used in statements like CREATE TABLE.
|
||||||
@ -184,36 +184,38 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict {
|
|||||||
if ($fixed !== false) {
|
if ($fixed !== false) {
|
||||||
$fixed = true;
|
$fixed = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
$type[] = 'date';
|
$type[] = 'date';
|
||||||
$length = null;
|
$length = null;
|
||||||
break;
|
break;
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
case 'timestamp':
|
case 'timestamp':
|
||||||
$type[] = 'timestamp';
|
$type[] = 'timestamp';
|
||||||
$length = null;
|
$length = null;
|
||||||
break;
|
break;
|
||||||
case 'time':
|
case 'time':
|
||||||
$type[] = 'time';
|
$type[] = 'time';
|
||||||
$length = null;
|
$length = null;
|
||||||
break;
|
break;
|
||||||
case 'float':
|
case 'float':
|
||||||
case 'double':
|
case 'double':
|
||||||
case 'real':
|
case 'real':
|
||||||
$type[] = 'float';
|
$type[] = 'float';
|
||||||
break;
|
$length = null;
|
||||||
|
break;
|
||||||
case 'decimal':
|
case 'decimal':
|
||||||
case 'numeric':
|
case 'numeric':
|
||||||
$type[] = 'decimal';
|
$type[] = 'decimal';
|
||||||
break;
|
$length = null;
|
||||||
|
break;
|
||||||
case 'tinyblob':
|
case 'tinyblob':
|
||||||
case 'mediumblob':
|
case 'mediumblob':
|
||||||
case 'longblob':
|
case 'longblob':
|
||||||
case 'blob':
|
case 'blob':
|
||||||
$type[] = 'blob';
|
$type[] = 'blob';
|
||||||
$length = null;
|
$length = null;
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
$type[] = 'integer';
|
$type[] = 'integer';
|
||||||
$type[] = 'date';
|
$type[] = 'date';
|
||||||
|
Loading…
Reference in New Issue
Block a user