better listColumns handling
This commit is contained in:
parent
862b7cdfaf
commit
9471145115
@ -104,18 +104,25 @@ class Doctrine_Import_Mysql extends Doctrine_Import
|
|||||||
{
|
{
|
||||||
$sql = 'DESCRIBE ' . $table;
|
$sql = 'DESCRIBE ' . $table;
|
||||||
$result = $this->conn->fetchAssoc($sql);
|
$result = $this->conn->fetchAssoc($sql);
|
||||||
|
|
||||||
$description = array();
|
$description = array();
|
||||||
foreach ($result as $key => $val) {
|
foreach ($result as $key => $val) {
|
||||||
|
|
||||||
array_change_key_case($val, CASE_LOWER);
|
$val = array_change_key_case($val, CASE_LOWER);
|
||||||
|
|
||||||
|
$decl = $this->conn->dataDict->getPortableDeclaration($val);
|
||||||
|
|
||||||
$description = array(
|
$description = array(
|
||||||
'name' => $val['field'],
|
'name' => $val['field'],
|
||||||
'type' => $val['type'],
|
'type' => $val['type'],
|
||||||
'primary' => (strtolower($val['key']) == 'pri'),
|
'ptype' => $decl['type'],
|
||||||
'default' => $val['default'],
|
'length' => $decl['length'],
|
||||||
'notnull' => (bool) ($val['null'] != 'YES'),
|
'fixed' => $decl['fixed'],
|
||||||
'autoinc' => (bool) (strpos($val['extra'], 'auto_increment') !== false),
|
'unsigned' => $decl['unsigned'],
|
||||||
|
'primary' => (strtolower($val['key']) == 'pri'),
|
||||||
|
'default' => $val['default'],
|
||||||
|
'notnull' => (bool) ($val['null'] != 'YES'),
|
||||||
|
'autoinc' => (bool) (strpos($val['extra'], 'auto_increment') !== false),
|
||||||
);
|
);
|
||||||
$columns[$val['field']] = $description;
|
$columns[$val['field']] = $description;
|
||||||
}
|
}
|
||||||
@ -144,7 +151,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import
|
|||||||
}
|
}
|
||||||
|
|
||||||
$table = $this->conn->quoteIdentifier($table, true);
|
$table = $this->conn->quoteIdentifier($table, true);
|
||||||
$query = "SHOW INDEX FROM $table";
|
$query = 'SHOW INDEX FROM ' . $table;
|
||||||
$indexes = $this->conn->fetchAssoc($query);
|
$indexes = $this->conn->fetchAssoc($query);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user