Parcourir la source

Fixed:修复setAttribute bugs

Jinhui Zhu il y a 5 ans
Parent
commit
bd1abb7ade
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      src/Driver/Pdo/Driver.php

+ 2 - 0
src/Driver/Pdo/Driver.php

@@ -216,6 +216,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
      * @param $val
      */
     public function setAttribute($key, $val){
+        $this->db['CURRENT'] = $this->connection->getWriteConnection();
         $this->db['CURRENT']->setAttribute($key, $val);
     }
     /**
@@ -223,6 +224,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
      */
     public function transaction()
     {
+        $this->db['CURRENT'] = $this->connection->getWriteConnection();
         return $this->db['CURRENT']->beginTransaction();
     }