瀏覽代碼

Update: Fixed 多次调用获取用户数据库连接问题

Jinhui Zhu 5 年之前
父節點
當前提交
996375c035
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/Driver/Pdo/Driver.php

+ 3 - 3
src/Driver/Pdo/Driver.php

@@ -282,9 +282,9 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
      */
     public function setError()
     {
-        if ($this->connection->getConnectionBySQL($this->sql)->errorCode() != '00000') {
+        if ($this->db['CURRENT']->errorCode() != '00000') {
             $this->_errorInfo[$this->queryTimes]['sql'] = $this->sql;
-            $this->_errorInfo[$this->queryTimes]['error'] = $this->iconv($this->connection->getConnectionBySQL($this->sql)->errorInfo());
+            $this->_errorInfo[$this->queryTimes]['error'] = $this->iconv($this->db['CURRENT']->errorInfo());
             $this->response = \Qii\Driver\Response::Fail('pdo.error', $this->_errorInfo);
         }
     }
@@ -299,7 +299,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
         if (!$this->rs) {
             return true;
         }
-        if ($this->connection->getConnectionBySQL($this->sql)->errorCode() != '00000') {
+        if ($this->db['CURRENT']->errorCode() != '00000') {
             return true;
         }
         return false;