Changeset 3417

Show
Ignore:
Timestamp:
09/07/2008 09:17:16 AM (2 months ago)
Author:
Geert
Message:

A few fixes and optimizations for the ORM library.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/classes/orm.php

    r3416 r3417  
    198198                                // We use switch here to manually call the database methods. This is 
    199199                                // done for speed: call_user_func_array can take over 300% longer to 
    200                                 // make calls. Mose database methods are 4 arguments or less, so this 
     200                                // make calls. Most database methods are 4 arguments or less, so this 
    201201                                // avoids almost any calls to call_user_func_array. 
    202202 
     
    814814                        { 
    815815                                // Remove LIMIT from the SQL 
    816                                 $sql = preg_replace('/\bLIMIT\s+[^a-z]+/i', '', $sql); 
     816                                $sql = preg_replace('/\sLIMIT\s+[^a-z]+/i', ' ', $sql); 
    817817                        } 
    818818 
     
    820820                        { 
    821821                                // Remove OFFSET from the SQL 
    822                                 $sql = preg_replace('/\bOFFSET\s+\d+/i', '', $sql); 
     822                                $sql = preg_replace('/\sOFFSET\s+\d+/i', '', $sql); 
    823823                        } 
    824824 
     
    830830                        ); 
    831831 
    832                         if ($result->count()) 
    833                         { 
    834                                 // Return the total number of rows from the query 
    835                                 return (int) $result->current()->total_rows; 
    836                         } 
     832                        // Return the total number of rows from the query 
     833                        return (int) $result->current()->total_rows; 
    837834                } 
    838835 
     
    991988                { 
    992989                        case 'int': 
    993                                 $value = ($value === '' AND ! empty($data['null'])) ? NULL : (int) $value; 
     990                                $value = ($value === '' AND ! empty($column['null'])) ? NULL : (int) $value; 
    994991                        break; 
    995992                        case 'float':