示例#1
0
 /**
  * (non-PHPdoc)
  *
  * @see TyDB_Abstract::_connect()
  */
 protected function _connect($isReader = true)
 {
     // 		$config = $isReader ? $this->_reader : $this->_writer;
     $config = $this->_writer;
     try {
         if (empty($this->pdo)) {
             $this->pdo = new \PDO("mysql:host={$config['host']};dbname={$config['dbname']};port={$config['port']};charset={$config['charset']}", $config['user'], $config['password'], array(\PDO::ATTR_PERSISTENT => true, \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_TIMEOUT => 2, \PDO::ATTR_EMULATE_PREPARES => true));
         }
     } catch (\PDOException $e) {
         $msg = $e->getMessage();
         Lib_Log::write('system_sql', 'connect', $msg);
     }
 }