Changeset 254
- Timestamp:
- 08/28/06 23:07:08 (6 years ago)
- Files:
-
- 1 modified
-
trunk/trax/vendor/trax/active_record.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/active_record.php
r252 r254 2154 2154 foreach($attributes as $key => $value) { 2155 2155 $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; 2158 2163 } 2159 2164 return $return; … … 2464 2469 * @uses column_for_attribute() 2465 2470 */ 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; 2480 2481 } 2481 2482 return false;
