Changeset 112 for trunk/trax/vendor/trax/active_record.php
- Timestamp:
- 01/11/06 16:00:15 (6 years ago)
- Files:
-
- 1 modified
-
trunk/trax/vendor/trax/active_record.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/active_record.php
r110 r112 28 28 class ActiveRecord { 29 29 30 static private $db = null; # Reference to Pear db object 31 static protected $inflector = null; # object to do class inflection 32 public $content_columns = null; # info about each column in the table 33 public $table_name = null; 30 static private $db = null; # Reference to Pear db object 31 static protected $inflector = null; # object to do class inflection 32 public $content_columns = null; # info about each column in the table 33 public $table_name = null; # if you want to override table name set this in your model 34 public $database_name = null; # if you want to override database name set this in your model 34 35 public $fetch_mode = DB_FETCHMODE_ASSOC; 36 public $force_reconnect = false; # should we force a connection everytime 35 37 36 38 # Table associations … … 994 996 function establish_connection() { 995 997 # Connect to the database and throw an error if the connect fails. 996 if(!is_object($GLOBALS['ACTIVE_RECORD_DB']) ) {998 if(!is_object($GLOBALS['ACTIVE_RECORD_DB']) || $this->force_reconnect) { 997 999 if(array_key_exists("use", $GLOBALS['TRAX_DB_SETTINGS'][TRAX_MODE])) { 998 1000 $connection_settings = $GLOBALS['TRAX_DB_SETTINGS'][$GLOBALS['TRAX_DB_SETTINGS'][TRAX_MODE]['use']]; … … 1000 1002 $connection_settings = $GLOBALS['TRAX_DB_SETTINGS'][TRAX_MODE]; 1001 1003 } 1004 # Override database name if param is set 1005 if($this->database_name) { 1006 $connection_settings['database'] = $this->database_name; 1007 } 1002 1008 # Set optional Pear parameters 1003 1009 if(isset($connection_settings['persistent'])) {
