Changeset 3610
- Timestamp:
- 01/24/08 20:10:28 (18 months ago)
- Location:
- branches/0.9/lib/Doctrine
- Files:
-
- 3 modified
-
DataDict/Mysql.php (modified) (2 diffs)
-
Query/JoinCondition.php (modified) (3 diffs)
-
Query/Where.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9/lib/Doctrine/DataDict/Mysql.php
r3084 r3610 317 317 case 'enum': 318 318 $type[] = 'enum'; 319 preg_match_all('/\' .+\'/U', $field['type'], $matches);319 preg_match_all('/\'((?:\'\'|[^\'])*)\'/', $field['type'], $matches); 320 320 $length = 0; 321 321 $fixed = false; 322 322 if (is_array($matches)) { 323 foreach ($matches[0] as $value) { 324 $length = max($length, strlen($value)-2); 325 } 326 if ($length == '1' && count($matches[0]) == 2) { 323 foreach ($matches[1] as &$value) { 324 $value = str_replace('\'\'', '\'', $value); 325 $length = max($length, strlen($value)); 326 } 327 if ($length == '1' && count($matches[1]) == 2) { 327 328 $type[] = 'boolean'; 328 329 if (preg_match('/^(is|has)/', $field['name'])) { … … 330 331 } 331 332 } else { 332 $values = $matches[0]; 333 } 334 } 335 $type[] = 'integer'; 333 $values = $matches[1]; 334 } 335 } 336 $type[] = 'integer'; 337 break; 336 338 case 'set': 337 339 $fixed = false; -
branches/0.9/lib/Doctrine/Query/JoinCondition.php
r2702 r3610 46 46 $value = $e[2]; 47 47 48 $conn = $this->query->getConnection(); 48 49 $alias = $this->query->getTableAlias($reference); 49 50 $map = $this->query->getAliasDeclaration($reference); … … 52 53 $enumIndex = $table->enumIndex($field, trim($value, "'")); 53 54 55 if (false !== $enumIndex && $conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) { 56 $enumIndex = $conn->quote($enumIndex, 'text'); 57 } 54 58 55 59 if (substr($value, 0, 1) == '(') { … … 69 73 $value = array(); 70 74 foreach ($e as $part) { 71 $index = $table->enumIndex($field, trim($part, "'")); 75 $index = $table->enumIndex($field, trim($part, "'")); 76 77 if (false !== $index && $conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) { 78 $index = $conn->quote($index, 'text'); 79 } 80 72 81 if ($index !== false) { 73 82 $value[] = $index; -
branches/0.9/lib/Doctrine/Query/Where.php
r3029 r3610 89 89 public function parseValue($value, Doctrine_Table $table = null, $field = null) 90 90 { 91 $conn = $this->query->getConnection(); 92 91 93 if (substr($value, 0, 1) == '(') { 92 94 // trim brackets … … 113 115 if (isset($table) && isset($field)) { 114 116 $index = $table->enumIndex($field, trim($part, "'")); 117 118 if (false !== $index && $conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) { 119 $index = $conn->quote($index, 'text'); 120 } 115 121 } 116 122 … … 136 142 // check if value is enumerated value 137 143 $enumIndex = $table->enumIndex($field, trim($value, "'")); 144 145 if (false !== $enumIndex && $conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) { 146 $enumIndex = $conn->quote($enumIndex, 'text'); 147 } 138 148 } 139 149