Bug #60930 [Opn->Nab]: PDO exec
Edit report at https://bugs.php.net/bug.php?id=60930&edit=1
ID: 60930
Updated by: uw@php.net
Reported by: lenzai2004-dev at yahoo dot fr
Summary: PDO exec
-Status: Open
+Status: Not a bug
Type: Bug
Package: PDO related
Operating System: Ubuntu 11.10 64bits
PHP Version: 5.3.9
Block user comment: N
Private report: N
New Comment:
There is no bug here. Do as the message says and everything works fine.
It is not possible to run another statement on a MySQL line prior to fetching the results. By
default - as the message says - there is no implicit fetch of results. Thus, you must explicitly
fetch them.
Previous Comments:
------------------------------------------------------------------------
[2012-01-30 01:26:19] lenzai2004-dev at yahoo dot fr
Description:
------------
SQL statement that return or should return a statement could leave an open cursor that cannot be
closed.
This bug is related to the following previous reports
https://bugs.php.net/bug.php?id=36347
https://bugs.php.net/bug.php?id=34499
https://bugs.php.net/bug.php?id=42499
It's been reported that sql statement that do return result could cause this issue in non
trivial situations.
This report also highlight that statement returning empty result set could also cause the issue.
Test script:
---------------
$dbh = new PDO("mysql:your connection string", '', '');
echo $dbh->exec("SELECT * FROM cube where false");
echo $dbh->exec("SELECT * FROM cube where false");
print_r($dbh->errorInfo());
Expected result:
----------------
00
Actual result:
--------------
0Array
(
[0] => HY000
[1] => 2014
[2] => 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.
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60930&edit=1
Thread (3 messages)