Changeset 3610

Show
Ignore:
Timestamp:
01/24/08 20:10:28 (18 months ago)
Author:
baron314159
Message:

Merged 3586 into .9 branch.

Location:
branches/0.9/lib/Doctrine
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/0.9/lib/Doctrine/DataDict/Mysql.php

    r3084 r3610  
    317317            case 'enum': 
    318318                $type[] = 'enum'; 
    319                 preg_match_all('/\'.+\'/U', $field['type'], $matches); 
     319                preg_match_all('/\'((?:\'\'|[^\'])*)\'/', $field['type'], $matches); 
    320320                $length = 0; 
    321321                $fixed = false; 
    322322                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) { 
    327328                        $type[] = 'boolean'; 
    328329                        if (preg_match('/^(is|has)/', $field['name'])) { 
     
    330331                        } 
    331332                    } else { 
    332                         $values = $matches[0]; 
    333                     } 
    334                 } 
    335                 $type[] = 'integer'; 
     333                        $values = $matches[1]; 
     334                    } 
     335                } 
     336                $type[] = 'integer'; 
     337                break; 
    336338            case 'set': 
    337339                $fixed = false; 
  • branches/0.9/lib/Doctrine/Query/JoinCondition.php

    r2702 r3610  
    4646            $value     = $e[2]; 
    4747 
     48            $conn      = $this->query->getConnection(); 
    4849            $alias     = $this->query->getTableAlias($reference); 
    4950            $map       = $this->query->getAliasDeclaration($reference); 
     
    5253            $enumIndex = $table->enumIndex($field, trim($value, "'")); 
    5354 
     55            if (false !== $enumIndex && $conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) { 
     56                $enumIndex = $conn->quote($enumIndex, 'text'); 
     57            } 
    5458 
    5559            if (substr($value, 0, 1) == '(') { 
     
    6973                    $value = array(); 
    7074                    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 
    7281                        if ($index !== false) { 
    7382                            $value[] = $index; 
  • branches/0.9/lib/Doctrine/Query/Where.php

    r3029 r3610  
    8989    public function parseValue($value, Doctrine_Table $table = null, $field = null) 
    9090    { 
     91        $conn = $this->query->getConnection(); 
     92 
    9193        if (substr($value, 0, 1) == '(') { 
    9294            // trim brackets 
     
    113115                    if (isset($table) && isset($field)) { 
    114116                        $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                        } 
    115121                    } 
    116122 
     
    136142                // check if value is enumerated value 
    137143                $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                } 
    138148            } 
    139149