Changeset 254

Show
Ignore:
Timestamp:
08/28/06 23:07:08 (6 years ago)
Author:
john
Message:

fixing quoted_attributes()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/vendor/trax/active_record.php

    r252 r254  
    21542154        foreach($attributes as $key => $value) { 
    21552155            $value = $this->check_datetime($key, $value); 
    2156             $type = $this->attribute_is_string($key) ? "Text" : "Integer"; 
    2157             $return[$key] = self::$db->quote($value, $type); 
     2156            $column = $this->column_for_attribute($key); 
     2157            $type = $this->attribute_is_string($key, $column['mdb2type']) ? "Text" : "Integer"; 
     2158            $value = self::$db->quote($value, $type); 
     2159            if($value == 'NULL' && $column['notnull']) { 
     2160                $value = "''";     
     2161            } 
     2162            $return[$key] = $value; 
    21582163        } 
    21592164        return $return; 
     
    24642469     *  @uses column_for_attribute() 
    24652470     */     
    2466     function attribute_is_string($attribute) { 
    2467         $column_type = $this->column_type($attribute); 
    2468         if(stristr($column_type, 'string') || 
    2469            stristr($column_type, 'char') || 
    2470            stristr($column_type, 'blob') ||  
    2471            stristr($column_type, 'text') ||  
    2472            stristr($column_type, 'time') ||  
    2473            stristr($column_type, 'date') || 
    2474            stristr($column_type, 'string') || 
    2475            stristr($column_type, 'clob') || 
    2476            stristr($column_type, 'year') || 
    2477            stristr($column_type, 'enum')) { 
    2478              
    2479             return true; 
     2471    function attribute_is_string($attribute, $column = null) { 
     2472        $column = is_null($column) ? $this->column_for_attribute($attribute) : $column; 
     2473        switch(strtolower($column['mdb2type'])) { 
     2474            case 'text': 
     2475            case 'timestamp': 
     2476            case 'date': 
     2477            case 'time': 
     2478            case 'blob': 
     2479            case 'clob': 
     2480                return true;        
    24802481        } 
    24812482        return false;