diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-08-18 11:51:13 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-08-22 00:32:09 +0300 |
commit | 1d8f236035d393a8b2d7e2939e1d7752be98227a (patch) | |
tree | 68bbd2d77b9761cf1498f259dcc09cd399ddd3d9 /core/Db | |
parent | d33c43a5ad5078ad3a6669196f6b33855067ca38 (diff) |
make sure it works if connection is created again, added test
Diffstat (limited to 'core/Db')
-rw-r--r-- | core/Db/Adapter/Pdo/Mysql.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/core/Db/Adapter/Pdo/Mysql.php b/core/Db/Adapter/Pdo/Mysql.php index 1d25cc3533..05fc583dac 100644 --- a/core/Db/Adapter/Pdo/Mysql.php +++ b/core/Db/Adapter/Pdo/Mysql.php @@ -61,12 +61,21 @@ class Mysql extends Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface */ $this->_connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + return $this->_connection; + } + + protected function _connect() + { + if ($this->_connection) { + return; + } + + parent::_connect(); + // MYSQL_ATTR_USE_BUFFERED_QUERY will use more memory when enabled // $this->_connection->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); $this->_connection->exec('SET sql_mode = "STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE"'); - - return $this->_connection; } /** |