Beispiel #1
0
 /**
  * Database Loader
  *
  * @param	string	the DB credentials
  * @param	bool	whether to return the DB object
  * @param	bool	whether to enable active record (this allows us to override the config setting)
  * @return	object
  */
 public function database($params = '', $return = FALSE, $active_record = NULL)
 {
     // Grab the super object
     $CI =& ci_get_instance();
     // Do we even need to load the database class?
     if (class_exists('CI_DB') and $return == FALSE and $active_record == NULL and isset($CI->db) and is_object($CI->db)) {
         return FALSE;
     }
     require_once BASEPATH . 'database/DB.php';
     if ($return === TRUE) {
         return HC_DB($params, $active_record);
     }
     // Initialize the db variable.  Needed to prevent
     // reference errors with some configurations
     $CI->db = '';
     // Load the DB class
     $CI->db =& HC_DB($params, $active_record);
 }
Beispiel #2
0
 /** Load the database drivers **/
 public function database($params = '', $return = FALSE, $active_record = NULL)
 {
     if (class_exists('CI_DB', FALSE) and $return == FALSE and $active_record == NULL and isset(CI::$APP->db) and is_object(CI::$APP->db)) {
         return;
     }
     require_once BASEPATH . 'database/DB' . EXT;
     if ($return === TRUE) {
         return HC_DB($params, $active_record);
     }
     CI::$APP->db = HC_DB($params, $active_record);
     return CI::$APP->db;
 }