Closed
Description
Greetings!
I have faced the following problem: after my shared hosting provider upgraded PHP, I started to receive the following error:
SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
Is there a way to set the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY through the standard Symfony 2 configuration?
Activity
Kezino commentedon Jan 15, 2013
Found the solution:
Now it works well.
afranioce commentedon Mar 17, 2015
+1
jdemangeon commentedon Feb 25, 2016
+1
health901 commentedon Mar 30, 2016
not work for me
jdemangeon commentedon Mar 30, 2016
@health901 Which driver do you use ?
hectorprats commentedon Jan 22, 2018
Close your sql cursor like here:
$stmt = $this->container->get('doctrine.orm.entity_manager')->getConnection()->prepare($content);
$stmt->execute();
$stmt->closeCursor();
Then, you can use your conection to do more queries.
Otech2018 commentedon Dec 18, 2020
Illuminate\Database\QueryExceptionSQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. (SQL: update chats set status ='2' WHERE sender_id = 6 and receiver_id = 15 and status = 1 )
I need help on this error
derrabus commentedon Dec 18, 2020
@Otech2018: thank you for reaching out.
This tracker is meant for tracking bugs and feature requests. If you are looking for support, you'll get faster responses by using one of our official support channels:
See https://symfony.com/support for more support options.
NamiNasih commentedon May 25, 2021
Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while there are pending result sets. Consider unsetting the previous PDOStatement
This error is always happens while there were two executions at a same time for example:
CASE 1
if(!$query->execute())
else
Solution: Second execution is no needed, remove second one, the first execution is already executed.
if the first case is not working, USE this Solution call this function after $query=$handler->prepare($sql);
$query->closeCursor();
I hope this Solution is helpful