Skip to content
Permalink
Browse files

Correctly re-setting the buffered statement setting for MySQL in case…

… of an exception

closes #10135
  • Loading branch information...
lorenzo committed Jan 31, 2017
1 parent b2b7f76 commit da419ca7372a08eda60d826104294c43775b5992
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/Database/Statement/MysqlStatement.php
@@ -32,9 +32,14 @@ class MysqlStatement extends PDOStatement
*/
public function execute($params = null)
{
$this->_driver->connection()->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, $this->_bufferResults);
$result = $this->_statement->execute($params);
$this->_driver->connection()->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
$connection = $this->_driver->connection();
try {
$connection->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, $this->_bufferResults);
$result = $this->_statement->execute($params);
} finally {
$connection->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
}
return $result;
}

0 comments on commit da419ca

Please sign in to comment.
You can’t perform that action at this time.