示例#1
0
 function connect()
 {
     if ($this->isConnected) {
         return;
     }
     parent::connect();
     if ($this->debugLevel & self::DEBUG_EXPLAIN) {
         $this->pdo->exec('SET TRACE ON');
     }
 }
示例#2
0
文件: Cubrid.php 项目: kidaa30/redcat
 function connect()
 {
     if ($this->isConnected) {
         return;
     }
     parent::connect();
     if ($this->loggingExplain) {
         $this->pdo->exec('SET TRACE ON');
     }
 }
示例#3
0
 function connect()
 {
     if ($this->isConnected) {
         return;
     }
     parent::connect();
     $serverVersion = $this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION);
     $this->isMariaDB = strpos($serverVersion, 'MariaDB') !== false;
     if ($this->isMariaDB) {
         $this->version = substr($serverVersion, 0, strpos($serverVersion, '-'));
     } else {
         $this->version = floatval($serverVersion);
     }
     if (!$this->isMariaDB && $this->version >= 5.5) {
         $this->encoding = 'utf8mb4';
     }
     $this->pdo->setAttribute(\PDO::MYSQL_ATTR_INIT_COMMAND, 'SET NAMES ' . $this->encoding);
     //on every re-connect
     $this->pdo->exec('SET NAMES ' . $this->encoding);
     //also for current connection
 }