protected function _initDb() { $file = APPLICATION_PATH . '/settings/database.php'; $options = (include $file); $db = Zend_Db::factory($options['adapter'], $options['params']); Khcn_Db_Table::setDefaultAdapter($db); Khcn_Db_Table::setTablePrefix($options['tablePrefix']); // Non-production if (APPLICATION_ENV !== 'production') { $db->setProfiler(array('class' => 'Zend_Db_Profiler_Firebug', 'enabled' => true)); } // set DB to UTC timezone for this session switch ($options['adapter']) { case 'mysqli': case 'mysql': case 'pdo_mysql': $db->query("SET time_zone = '+0:00'"); break; case 'postgresql': $db->query("SET time_zone = '+0:00'"); break; default: // do nothing } // attempt to disable strict mode try { $db->query("SET SQL_MODE = ''"); } catch (Exception $e) { } $profiler = new Zend_Db_Profiler_Firebug('All DB Queries'); //$profiler->setEnabled(true); //$db->setProfiler($profiler); Zend_Registry::set('connectDB', $db); Zend_Registry::set('configDB', $options['params']); return $db; }