1
0
mirror of synced 2025-02-20 06:03:15 +03:00
This commit is contained in:
zYne 2007-06-28 12:11:55 +00:00
parent f4842edd98
commit 417b71f447
6 changed files with 27 additions and 12 deletions

View File

@ -120,7 +120,7 @@ END;
$i = 1;
foreach ($tableColumns as $name => $column) {
$columns[$i] = ' $this->hasColumn(\'' . $name . '\', \'' . $column['ptype'][0] . '\'';
$columns[$i] = ' $this->hasColumn(\'' . $name . '\', \'' . $column['type'] . '\'';
if ($column['length']) {
$columns[$i] .= ', ' . $column['length'];
} else {
@ -147,7 +147,7 @@ END;
if (isset($column['unsigned']) && $column['unsigned']) {
$a[] = '\'unsigned\' => true';
}
if ($column['ptype'][0] == 'enum' && isset($column['values']) && $column['values']) {
if ($column['type'] == 'enum' && isset($column['values']) && $column['values']) {
$a[] = '\'values\' => array(' . implode(',', $column['values']) . ')';
}

View File

@ -59,6 +59,8 @@ class Doctrine_Import_Mssql extends Doctrine_Import
$columns = array();
foreach ($result as $key => $val) {
$val = array_change_key_case($val, CASE_LOWER);
if (strstr($val['type_name'], ' ')) {
list($type, $identity) = explode(' ', $val['type_name']);
} else {
@ -74,8 +76,9 @@ class Doctrine_Import_Mssql extends Doctrine_Import
$description = array(
'name' => $val['column_name'],
'type' => $type,
'ptype' => $decl['type'],
'ntype' => $type,
'type' => $decl['type'][0],
'alltypes' => $decl['type'],
'length' => $decl['length'],
'fixed' => $decl['fixed'],
'unsigned' => $decl['unsigned'],

View File

@ -124,8 +124,9 @@ class Doctrine_Import_Mysql extends Doctrine_Import
$description = array(
'name' => $val['field'],
'type' => $val['type'],
'ptype' => $decl['type'],
'type' => $decl['type'][0],
'alltypes' => $decl['type'],
'ntype' => $val['type'],
'length' => $decl['length'],
'fixed' => $decl['fixed'],
'unsigned' => $decl['unsigned'],

View File

@ -122,13 +122,16 @@ class Doctrine_Import_Oracle extends Doctrine_Import
$result = $this->conn->fetchAssoc($sql);
foreach($result as $val) {
$val = array_change_key_case($val, CASE_LOWER);
$decl = $this->conn->dataDict->getPortableDeclaration($val);
$descr[$val['column_name']] = array(
'name' => $val['column_name'],
'notnull' => (bool) ($val['nullable'] === 'N'),
'type' => $val['data_type'],
'ptype' => $decl['type'],
'ntype' => $val['data_type'],
'type' => $decl['type'][0],
'alltypes' => $decl['type'],
'fixed' => $decl['fixed'],
'unsigned' => $decl['unsigned'],
'default' => $val['data_default'],

View File

@ -154,7 +154,9 @@ class Doctrine_Import_Pgsql extends Doctrine_Import
$columns = array();
foreach ($result as $key => $val) {
if ($val['type'] === 'varchar') {
$val = array_change_key_case($val, CASE_LOWER);
if (strtolower($val['type']) === 'varchar') {
// get length from varchar definition
$length = preg_replace('~.*\(([0-9]*)\).*~', '$1', $val['complete_type']);
$val['length'] = $length;
@ -164,8 +166,9 @@ class Doctrine_Import_Pgsql extends Doctrine_Import
$description = array(
'name' => $val['field'],
'type' => $val['type'],
'ptype' => $decl['type'],
'ntype' => $val['type'],
'type' => $decl['type'][0],
'alltypes' => $decl['type'],
'length' => $decl['length'],
'fixed' => $decl['fixed'],
'unsigned' => $decl['unsigned'],

View File

@ -130,9 +130,14 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
$description = array();
$columns = array();
foreach ($result as $key => $val) {
$val = array_change_key_case($val, CASE_LOWER);
$decl = $this->conn->dataDict->getPortableDeclaration($val);
$description = array(
'name' => $val['name'],
'type' => $val['type'],
'ntype' => $val['type'],
'type' => $decl['type'][0],
'alltypes' => $decl['type'],
'notnull' => (bool) $val['notnull'],
'default' => $val['dflt_value'],
'primary' => (bool) $val['pk'],