diff --git a/lib/Doctrine/Connection.php b/lib/Doctrine/Connection.php index fe8a3af57..9b45c64a1 100644 --- a/lib/Doctrine/Connection.php +++ b/lib/Doctrine/Connection.php @@ -96,7 +96,8 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun 'escape' => false, 'escape_pattern' => false ), - 'wildcards' => array('%', '_') + 'wildcards' => array('%', '_'), + 'varchar_max_length' => 255, ); /** * @var array $serverInfo diff --git a/lib/Doctrine/DataDict/Mysql.php b/lib/Doctrine/DataDict/Mysql.php index 0d3aa2534..e86cb1915 100644 --- a/lib/Doctrine/DataDict/Mysql.php +++ b/lib/Doctrine/DataDict/Mysql.php @@ -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; - return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR(255)') + return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)') : ($length ? 'VARCHAR(' . $length . ')' : 'TEXT'); case 'clob': if (!empty($field['length'])) {