Show
Ignore:
Timestamp:
08/29/06 00:11:51 (6 years ago)
Author:
john
Message:

added table_info to hold tableInfo

Files:
1 modified

Legend:

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

    r258 r259  
    102102 
    103103    /** 
     104     *  Table Info 
     105     * 
     106     *  Array to hold all the info about table columns.  Index on $table_name. 
     107     *  @var array 
     108     */     
     109    public static $table_info = array(); 
     110 
     111    /** 
    104112     *  Class name 
    105113     * 
     
    120128     */ 
    121129    public $table_name = null; 
    122  
     130     
    123131    /** 
    124132     *  Table prefix 
     
    22872295     */ 
    22882296    function set_content_columns($table_name) { 
    2289         self::$db->loadModule('Reverse', null, true); 
    2290         $this->content_columns = self::$db->reverse->tableInfo($table_name); 
    2291         if($this->is_error($this->content_columns)) { 
    2292             $this->raise($this->content_columns->getMessage());         
    2293         } 
    2294         if(is_array($this->content_columns)) { 
    2295             $i = 0; 
    2296             foreach($this->content_columns as $column) { 
    2297                 $this->content_columns[$i++]['human_name'] = Inflector::humanize($column['name']); 
     2297        if(isset(self::$table_info[$table_name])) { 
     2298            $this->content_columns = self::$table_info[$table_name];   
     2299        } else { 
     2300            self::$db->loadModule('Reverse', null, true); 
     2301            $this->content_columns = self::$db->reverse->tableInfo($table_name); 
     2302            if($this->is_error($this->content_columns)) { 
     2303                $this->raise($this->content_columns->getMessage());         
     2304            } 
     2305            if(is_array($this->content_columns)) { 
     2306                $i = 0; 
     2307                foreach($this->content_columns as $column) { 
     2308                    $this->content_columns[$i++]['human_name'] = Inflector::humanize($column['name']); 
     2309                } 
     2310                self::$table_info[$table_name] = $this->content_columns; 
    22982311            } 
    22992312        }