Edit report at https://bugs.php.net/bug.php?id=61613&edit=1
ID: 61613
User updated by: trebitzki at gmx dot net
Reported by: trebitzki at gmx dot net
Summary: No PDO error if first SQL statement of a group is
valid.
Status: Assigned
Type: Bug
Package: PDO MySQL
Operating System: Mac OS X
PHP Version: 5.3.10
Assigned To: mysql
Block user comment: N
Private report: N
New Comment:
The test script I included in my original bug report for this issue was only a simple example. I
actually had this issue with a set of SQL UPDATE statements, so showing how fetching rows and
looping through result sets obviates this is not really addressing the issue. When my first update
statement runs successfully I can't call nextrowset(); the statements just run one after the
other. The problem with not getting error info for any following statement that may fail still
stands. And I must say that I am very surprised and disappointed that noone in the php group is
willing to come to grips with this - after more than 2 1/2 years!
Previous Comments:
------------------------------------------------------------------------
[2014-09-24 16:38:09] benjamin dot morel at gmail dot com
@rquadling Genius!
Indeed, just tested it on a PDO configured to throw exceptions, and the PDOException is thrown as
soon as nextRowSet() is called!
When it's configured to *not* throw exceptions, as you guessed, the error information becomes
available with PDOStatement::getErrorInfo().
So there's no bug after all, the behaviour of PHP is perfectly fine, maybe we could just
mention this on the PDO error handling page in the docs?
http://php.net/manual/en/pdo.error-handling.php
Thanks so much.
------------------------------------------------------------------------
[2014-09-24 15:32:37] rquadling@php.net
As the query contains multiple result sets, what is the response if you actually take a look at the
next rowset using PDOStatement::nextRowSet() in conjunction with PDOStatement::errorInfo() /
PDOStatement::errorCode()?
------------------------------------------------------------------------
[2014-07-16 13:32:14] benjamin dot morel at gmail dot com
Is anyone working on this problem? As mentioned above, it can lead to dangerous bugs as there's
currently no way to know if all the queries have been successfully executed or not.
------------------------------------------------------------------------
[2014-03-31 05:39:17] oleg dot nucer at gmail dot com
I have the same problem! In multiqueries PDO throws an error only for the first statement. And there
is absolutely no difference what is going after... Please fix this problem, because it can lead to
critical security holes or just hard-to-find bugs in web-applications.
I'm using PHP 5.6 and MySQL 5.6 on Windows 8 x64.
------------------------------------------------------------------------
[2013-12-31 10:40:44] michal dot kikta at gmail dot com
really annoying bug causing serious production hazards if we want to optimize by batching multiple
queries
is there any workaround except rewriting our database layer to mysqli or writing stored procedure on
our mysql servers?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61613
--
Edit this bug report at https://bugs.php.net/bug.php?id=61613&edit=1