Skip to content

Commit

Permalink
Correctly re-setting the buffered statement setting for MySQL in case…
Browse files Browse the repository at this point in the history
… of an exception

closes #10135
  • Loading branch information
lorenzo committed Jan 31, 2017
1 parent b2b7f76 commit da419ca
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Database/Statement/MysqlStatement.php
Expand Up @@ -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;
}
Expand Down

0 comments on commit da419ca

Please sign in to comment.