1
0
mirror of synced 2025-03-05 04:13:20 +03:00

int alias added

This commit is contained in:
zYne 2007-02-04 22:34:44 +00:00
parent f2e19fd9fa
commit c38137d551
5 changed files with 14 additions and 6 deletions

View File

@ -75,6 +75,7 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
return 'BLOB SUB_TYPE 0'; return 'BLOB SUB_TYPE 0';
case 'integer': case 'integer':
case 'enum': case 'enum':
case 'int':
return 'INT'; return 'INT';
case 'boolean': case 'boolean':
return 'SMALLINT'; return 'SMALLINT';
@ -89,8 +90,9 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
case 'decimal': case 'decimal':
$length = !empty($field['length']) ? $field['length'] : 18; $length = !empty($field['length']) ? $field['length'] : 18;
return 'DECIMAL('.$length.','.$this->conn->options['decimal_places'].')'; return 'DECIMAL('.$length.','.$this->conn->options['decimal_places'].')';
default:
throw new Doctrine_DataDict_Exception('Unknown field type '. $field['type']);
} }
return '';
} }
/** /**
* Maps a native array description of a field to a Doctrine datatype and length * Maps a native array description of a field to a Doctrine datatype and length

View File

@ -90,6 +90,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
return 'IMAGE'; return 'IMAGE';
case 'integer': case 'integer':
case 'enum': case 'enum':
case 'int':
return 'INT'; return 'INT';
case 'boolean': case 'boolean':
return 'BIT'; return 'BIT';
@ -105,7 +106,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
$length = !empty($field['length']) ? $field['length'] : 18; $length = !empty($field['length']) ? $field['length'] : 18;
return 'DECIMAL('.$length.','.$this->conn->options['decimal_places'].')'; return 'DECIMAL('.$length.','.$this->conn->options['decimal_places'].')';
} }
return ''; throw new Doctrine_DataDict_Exception('Unknown column type.');
} }
/** /**
* 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

View File

@ -72,6 +72,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
return 'BLOB'; return 'BLOB';
case 'integer': case 'integer':
case 'enum': case 'enum':
case 'int':
if (!empty($field['length'])) { if (!empty($field['length'])) {
return 'NUMBER('.$field['length'].')'; return 'NUMBER('.$field['length'].')';
} }
@ -86,6 +87,8 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
return 'NUMBER'; return 'NUMBER';
case 'decimal': case 'decimal':
return 'NUMBER(*,'.$this->conn->options['decimal_places'].')'; return 'NUMBER(*,'.$this->conn->options['decimal_places'].')';
default:
throw new Doctrine_DataDict_Exception('Unknown field type '. $field['type']);
} }
} }
/** /**
@ -97,7 +100,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
*/ */
public function getPortableDeclaration(array $field) public function getPortableDeclaration(array $field)
{ {
$db_type = strtolower($field['type']); $dbType = strtolower($field['type']);
$type = array(); $type = array();
$length = $unsigned = $fixed = null; $length = $unsigned = $fixed = null;
if (!empty($field['length'])) { if (!empty($field['length'])) {
@ -108,7 +111,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
$field['name'] = ''; $field['name'] = '';
} }
switch ($db_type) { switch ($dbType) {
case 'integer': case 'integer':
case 'pls_integer': case 'pls_integer':
case 'binary_integer': case 'binary_integer':
@ -174,7 +177,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
case 'rowid': case 'rowid':
case 'urowid': case 'urowid':
default: default:
throw new Doctrine_DataDict_Exception('unknown database attribute type: '.$db_type); throw new Doctrine_DataDict_Exception('unknown database attribute type: ' . $dbType);
} }
return array($type, $length, $unsigned, $fixed); return array($type, $length, $unsigned, $fixed);

View File

@ -378,6 +378,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
return 'BYTEA'; return 'BYTEA';
case 'enum': case 'enum':
case 'integer': case 'integer':
case 'int':
if (!empty($field['autoincrement'])) { if (!empty($field['autoincrement'])) {
if (!empty($field['length'])) { if (!empty($field['length'])) {
$length = $field['length']; $length = $field['length'];

View File

@ -97,6 +97,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
case 'enum': case 'enum':
case 'integer': case 'integer':
case 'boolean': case 'boolean':
case 'int':
return 'INTEGER'; return 'INTEGER';
case 'date': case 'date':
return 'DATE'; return 'DATE';