Example #1
0
 private function error($query, $error)
 {
     //TODO: Handle Errors as required
     $CP = Bootstrap::get_instance();
     $CP->log->error('mysql error on query ' . $query);
     $CP->log->error($error);
     return true;
 }
Example #2
0
 public function __construct($name, $params = array())
 {
     $CP = Bootstrap::get_instance();
     $this->params = $params;
     $driver = $params['driver'];
     if (!isset($driver) or $driver == '') {
         $CP->log->error('database driver for ' . $name . ' is empty');
         return;
     }
     if (is_file(CORE . "/drivers/" . $driver . '.php')) {
         $classname = 'driver_' . $driver;
         if (!class_exists($classname)) {
             require_once CORE . "/drivers/" . $driver . '.php';
         }
         $this->dbclass = new $classname();
         if ($params['autoload']) {
             $this->connect();
         }
     } else {
         $CP->log->error('database driver file for ' . $name . ' is missing');
     }
 }
Example #3
0
 private function _load_log()
 {
     $CP = Bootstrap::get_instance();
     $this->load('log');
     $CP->log = new Log($CP->config->log);
 }