1
0
mirror of synced 2024-12-13 22:56:04 +03:00

varchar max length fix

This commit is contained in:
zYne 2007-02-17 18:18:44 +00:00
parent 81a8f3d545
commit b4099e45aa
2 changed files with 4 additions and 3 deletions

View File

@ -96,7 +96,8 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
'escape' => false, 'escape' => false,
'escape_pattern' => false 'escape_pattern' => false
), ),
'wildcards' => array('%', '_') 'wildcards' => array('%', '_'),
'varchar_max_length' => 255,
); );
/** /**
* @var array $serverInfo * @var array $serverInfo

View File

@ -152,10 +152,10 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
} }
} }
$length = ($field['length'] < $this->conn->varchar_max_length) ? $field['length'] : false; $length = ($field['length'] <= $this->conn->varchar_max_length) ? $field['length'] : false;
$fixed = (isset($field['fixed'])) ? $field['fixed'] : false; $fixed = (isset($field['fixed'])) ? $field['fixed'] : false;
return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR(255)') return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)')
: ($length ? 'VARCHAR(' . $length . ')' : 'TEXT'); : ($length ? 'VARCHAR(' . $length . ')' : 'TEXT');
case 'clob': case 'clob':
if (!empty($field['length'])) { if (!empty($field['length'])) {