Changeset 294 for trunk/trax/vendor/trax

Show
Ignore:
Timestamp:
05/13/08 04:11:08 (4 years ago)
Author:
john
Message:

Took out referrences to Trax in AR in prep to make it standalone

Location:
trunk/trax/vendor/trax
Files:
2 modified

Legend:

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

    r293 r294  
    154154     *  @var string 
    155155     */     
    156     public $connection_name = TRAX_ENV; 
     156    public $connection_name = null; 
     157 
     158    /** 
     159     * What environment to run in. 
     160     */ 
     161    public static $environment = 'development'; 
    157162 
    158163    /** 
     
    25032508     */ 
    25042509    function establish_connection() { 
     2510        $this->set_connection_name(); 
    25052511        $connection =& self::$active_connections[$this->connection_name]; 
    25062512        if(!is_object($connection) || $this->force_reconnect) { 
     
    25162522                } 
    25172523            } else { 
    2518                 # Just use the current TRAX_ENV's environment db settings 
    2519                 # $this->connection_name's default value is TRAX_ENV so 
    2520                 # if should never really get here unless override $this->connection_name 
     2524                # Just use the current environment's db settings 
     2525                # $this->connection_name's default value is 'development' so 
     2526                # if should never really get here unless you override $this->connection_name 
    25212527                # and you define a custom db section in database.ini and it can't find it. 
    2522                 $connection_settings = self::$database_settings[TRAX_ENV]; 
     2528                $connection_settings = self::$database_settings[$this->connection_name]; 
    25232529            } 
    25242530            # Override database name if param is set 
     
    25512557        }       
    25522558        return self::$db; 
     2559    } 
     2560 
     2561    /** 
     2562     *  Set the name of the database connection to use.  
     2563     */     
     2564    function set_connection_name() { 
     2565        $connection_name = null; 
     2566        if(!is_null($this->connection_name)) { 
     2567            $connection_name = $this->connection_name;       
     2568        } else { 
     2569            $connection_name = self::$environment ? self::$environment : 'development'; 
     2570        }   
     2571        $this->connection_name = $connection_name; 
    25532572    } 
    25542573 
     
    32233242     *  @param string SQL to be logged 
    32243243     */ 
    3225     function log_query($query) { 
    3226         if(TRAX_ENV == "development" && $query) { 
     3244    function log_query($query) {     
     3245        if(self::$environment == 'development' && $query) { 
    32273246            self::$query_log[] = $query;        
    32283247        }     
  • trunk/trax/vendor/trax/trax.php

    r287 r294  
    125125            ActiveRecord::$database_settings = parse_ini_file(self::$config_path."/database.ini", true); 
    126126        } 
     127        ActiveRecord::$environment = TRAX_ENV; 
    127128 
    128129    }