Changeset 294 for trunk/trax/vendor
- Timestamp:
- 05/13/08 04:11:08 (4 years ago)
- Location:
- trunk/trax/vendor/trax
- Files:
-
- 2 modified
-
active_record.php (modified) (5 diffs)
-
trax.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/active_record.php
r293 r294 154 154 * @var string 155 155 */ 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'; 157 162 158 163 /** … … 2503 2508 */ 2504 2509 function establish_connection() { 2510 $this->set_connection_name(); 2505 2511 $connection =& self::$active_connections[$this->connection_name]; 2506 2512 if(!is_object($connection) || $this->force_reconnect) { … … 2516 2522 } 2517 2523 } else { 2518 # Just use the current TRAX_ENV's environmentdb settings2519 # $this->connection_name's default value is TRAX_ENVso2520 # if should never really get here unless override $this->connection_name2524 # 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 2521 2527 # 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]; 2523 2529 } 2524 2530 # Override database name if param is set … … 2551 2557 } 2552 2558 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; 2553 2572 } 2554 2573 … … 3223 3242 * @param string SQL to be logged 3224 3243 */ 3225 function log_query($query) { 3226 if( TRAX_ENV == "development"&& $query) {3244 function log_query($query) { 3245 if(self::$environment == 'development' && $query) { 3227 3246 self::$query_log[] = $query; 3228 3247 } -
trunk/trax/vendor/trax/trax.php
r287 r294 125 125 ActiveRecord::$database_settings = parse_ini_file(self::$config_path."/database.ini", true); 126 126 } 127 ActiveRecord::$environment = TRAX_ENV; 127 128 128 129 }
