diff options
author | admin <devnull@localhost> | 2006-09-25 04:17:30 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-09-25 04:17:30 +0200 |
commit | a5e812c007b8dfbc4c117df379d63060f08b096a (patch) | |
tree | f21c197786638d4579995dbe2da6731617464c60 /system/libraries/Controller.php | |
parent | c9a8bab572388bbba541f1cf8f12a46e2103e447 (diff) |
Diffstat (limited to 'system/libraries/Controller.php')
-rw-r--r-- | system/libraries/Controller.php | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php index b91cf3b07..5fdbd9f9f 100644 --- a/system/libraries/Controller.php +++ b/system/libraries/Controller.php @@ -384,7 +384,7 @@ class Controller extends CI_Base { require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver'.EXT); // Instantiate the DB adapter - $driver = 'CI_DB_'. $params['dbdriver'].'_driver'; + $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; $DB = new $driver($params); if ($return === TRUE) @@ -397,7 +397,49 @@ class Controller extends CI_Base { $obj->db =& $DB; } // END _ci_init_database() - + + + // -------------------------------------------------------------------- + + /** + * Initialize Database Utilities Class + * + * @access private + * @param mixed database platform + * @param bool whether to return the object + * @return void + */ + function _ci_init_dbutils($db = '', $return = FALSE) + { + if ($this->_ci_is_loaded('dbutils') == TRUE AND $return == FALSE) + { + return; + } + + if ($this->_ci_is_loaded('db') == FALSE) + { + $this->_ci_init_database(); + } + + require_once(BASEPATH.'database/DB_utility'.EXT); + require_once(BASEPATH.'database/drivers/'.$this->db->dbdriver.'/'.$this->db->dbdriver.'_utility'.EXT); + + + // Instantiate the DB adapter + $driver = 'CI_DB_'.$this->db->dbdriver.'_utility'; + $DB = new $driver(); + + if ($return === TRUE) + { + return $DB; + } + + $obj =& get_instance(); + $obj->ci_is_loaded[] = 'dbutils'; + $obj->dbutil =& $DB; + } + // END _ci_init_database() + // -------------------------------------------------------------------- /** |