TL;DR I'm not asking how to make the error disappear, I don't want to know again that I can use fetchAll()
and/or turn buffered queries on.
Yet another question about this error:
SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active.
there are countless posts about this, and they are great, but that's not my interest.
I don't just want the error to go away, I want to know if there is a way to identify which unbuffered queries are still active?
Since I'm only using MySQL, and my application will only run with MySQL, I could of course
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
but that's not the point.
The man page for pdo doesn't seem to have a method to do this, and the inTransaction()
method doesn't apply since I'm not using transactions.
If it can help, all queries are prepared statements, just having the prepared sql would help me greatly pinpointing which query is not wholefully fetched.
var_dumping PDO object yields a not so useful result:
object(PDO)#31 (0) { }
my wet dream would be to be able to use something like this:
var_dump($pdo->showActiveQueries());
which would return something like
array(2) { [0]=> string(19) "SELECT foo FROM bar" [1]=> string(21) "SELECT 2foo FROM 2bar" }