Changeset 251 for trunk/trax/vendor/trax/active_record.php
- Timestamp:
- 08/26/06 10:27:55 (6 years ago)
- Files:
-
- 1 modified
-
trunk/trax/vendor/trax/active_record.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/active_record.php
r250 r251 139 139 140 140 /** 141 * Index into the Trax::$active_record_connections array141 * Index into the $active_connections array 142 142 * 143 143 * Name of the index to use to return or set the current db connection … … 147 147 */ 148 148 public $connection_name = TRAX_ENV; 149 150 /** 151 * Stores the database settings 152 */ 153 public static $database_settings = array(); 154 155 /** 156 * Stores the active connections 157 */ 158 public static $active_connections = array(); 149 159 150 160 /** … … 1267 1277 1268 1278 # Set number of total pages in result set 1269 if($count = $this->count_all( "*", $conditions, $joins)) {1279 if($count = $this->count_all($this->primary_keys[0], $conditions, $joins)) { 1270 1280 $this->pagination_count = $count; 1271 1281 $this->pages = ( … … 2310 2320 * 2311 2321 * The name of the database normally comes from 2312 * Trax::$database_settings which is set in {@link2322 * $database_settings which is set in {@link 2313 2323 * environment.php} by reading file config/database.ini. The 2314 2324 * database name may be overridden by assigning a different name … … 2316 2326 * 2317 2327 * If there is a connection now open, as indicated by the saved 2318 * value of a DB object in Trax::$active_record_connections[$connection_name], and2328 * value of a MDB2 object in $active_connections[$connection_name], and 2319 2329 * {@link force_reconnect} is not true, then set the database 2320 2330 * fetch mode and return. 2321 2331 * 2322 2332 * If there is no connection, open one and save a reference to 2323 * it in Trax::$active_record_connections[$connection_name].2333 * it in $active_connections[$connection_name]. 2324 2334 * 2325 2335 * @uses $db 2326 2336 * @uses $database_name 2327 2337 * @uses $force_reconnect 2328 * @uses Trax::$active_record_connections2338 * @uses $active_connections 2329 2339 * @uses is_error() 2330 2340 * @throws {@link ActiveRecordError} 2331 2341 */ 2332 2342 function establish_connection() { 2333 $connection =& Trax::$active_record_connections[$this->connection_name];2343 $connection =& self::$active_connections[$this->connection_name]; 2334 2344 if(!is_object($connection) || $this->force_reconnect) { 2335 if(array_key_exists($this->connection_name, Trax::$database_settings)) {2345 if(array_key_exists($this->connection_name, self::$database_settings)) { 2336 2346 # Use a different custom sections settings ? 2337 if(array_key_exists("use", Trax::$database_settings[$this->connection_name])) {2338 $connection_settings = Trax::$database_settings[Trax::$database_settings[$this->connection_name]['use']];2347 if(array_key_exists("use", self::$database_settings[$this->connection_name])) { 2348 $connection_settings = self::$database_settings[self::$database_settings[$this->connection_name]['use']]; 2339 2349 } else { 2340 2350 # Custom defined db settings in database.ini 2341 $connection_settings = Trax::$database_settings[$this->connection_name];2351 $connection_settings = self::$database_settings[$this->connection_name]; 2342 2352 } 2343 2353 } else { … … 2346 2356 # if should never really get here unless override $this->connection_name 2347 2357 # and you define a custom db section in database.ini and it can't find it. 2348 $connection_settings = Trax::$database_settings[TRAX_ENV];2358 $connection_settings = self::$database_settings[TRAX_ENV]; 2349 2359 } 2350 2360 # Override database name if param is set … … 2361 2371 } 2362 2372 if(!$this->is_error($connection)) { 2363 Trax::$active_record_connections[$this->connection_name] =& $connection;2373 self::$active_connections[$this->connection_name] =& $connection; 2364 2374 self::$db =& $connection; 2365 2375 } else {
