1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00
This commit is contained in:
zYne 2007-04-11 18:35:15 +00:00
parent dcab3087f7
commit 28e937b981
3 changed files with 11 additions and 3 deletions

View file

@ -137,7 +137,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
if ( ! isset($field['type'])) {
$field['type'] = null;
}
switch ($field['type']) {
case 'char':
$length = (! empty($field['length'])) ? $field['length'] : false;
@ -246,6 +246,8 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
if ( ! isset($field['name'])) {
$field['name'] = '';
}
$values = null;
switch ($dbType) {
case 'tinyint':
@ -304,7 +306,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
}
break;
case 'enum':
$type[] = 'text';
$type[] = 'enum';
preg_match_all('/\'.+\'/U', $field['type'], $matches);
$length = 0;
$fixed = false;
@ -317,6 +319,8 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
if (preg_match('/^(is|has)/', $field['name'])) {
$type = array_reverse($type);
}
} else {
$values = $matches[0];
}
}
$type[] = 'integer';
@ -369,7 +373,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
$length = ((int) $length == 0) ? null : (int) $length;
return array('type' => $type, 'length' => $length, 'unsigned' => $unsigned, 'fixed' => $fixed);
return array('type' => $type, 'length' => $length, 'unsigned' => $unsigned, 'fixed' => $fixed, 'values' => $values);
}
/**
* Obtain DBMS specific SQL code portion needed to set the CHARACTER SET

View file

@ -121,6 +121,9 @@ class Doctrine_Import_Builder
if (isset($column['unsigned']) && $column['unsigned']) {
$a[] = '\'unsigned\' => true';
}
if ($column['ptype'][0] == 'enum' && isset($column['values']) && $column['values']) {
$a[] = '\'values\' => array(' . implode(',', $column['values']) . ')';
}
if ( ! empty($a)) {
$columns[$i] .= ', ' . 'array(';

View file

@ -129,6 +129,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import
'length' => $decl['length'],
'fixed' => $decl['fixed'],
'unsigned' => $decl['unsigned'],
'values' => $decl['values'],
'primary' => (strtolower($val['key']) == 'pri'),
'default' => $val['default'],
'notnull' => (bool) ($val['null'] != 'YES'),