コード例 #1
0
ファイル: Model.php プロジェクト: adammajchrzak/silesiamaps
 public function __construct()
 {
     $this->_db = Zend_Registry::get('db');
     $this->_config = Zend_Registry::get('config');
     $this->_cSelect = Engine_Db::instance();
     $this->_cSelect->setTags(array());
 }
コード例 #2
0
ファイル: Db.php プロジェクト: adammajchrzak/silesiamaps
 public static function instance()
 {
     if (self::$_instance == false) {
         self::$_instance = new Engine_Db();
     }
     return self::$_instance;
 }
コード例 #3
0
 private function _initDatabase()
 {
     try {
         $this->_db = Zend_Db::factory($this->_config->database);
         Zend_Db_Table_Abstract::setDefaultAdapter($this->_db);
         /* do bazy danych bez domyślnego połączenia w trybie utf8	*/
         $this->_db->query('SET NAMES utf8');
     } catch (Exception $e) {
         if ($this->_config->mode == ' staging') {
             throw $e;
         } else {
             die($e);
         }
     }
     Zend_Registry::set('db', $this->_db);
     $cSelect = Engine_Db::instance();
     if ($this->_config->mode == 'staging') {
         $cSelect->setTimeout(0);
     }
 }