Edit report at https://bugs.php.net/bug.php?id=61613&edit=1
ID: 61613
Comment by: benjamin dot morel at gmail dot com
Reported by: trebitzki at gmx dot net
Summary: No PDO error if first SQL statement of a group is
valid.
Status: Not a bug
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:
I don't think the current implementation is really a problem. But the documentation has to be
clear about that, and the fact is, it isn't at the moment.
Previous Comments:
------------------------------------------------------------------------
[2015-09-16 11:53:26] Daniel at Kraffner dot de
Even if this is considered "by design", the issue should be addressed in someway.
The current situation is inconsistent and quite a lot developers stumble across it, leading to the
visible feedback within this bug report.
Why is an exception thrown right away, if a single statement is executed WITHOUT accessing the
result set? Why does the result set needs to be accessed when multiple queries are executed?
imho, the implementation should
- either never throw an exception if the result set is NOT accessed, even if it is a single query.
- or always throw an exception without accessing the result set even for multiple queries.
------------------------------------------------------------------------
[2015-09-16 10:31:26] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Since there are two statements and the first one is valid, you have to use nextRowset() and this is
expected behavior.
------------------------------------------------------------------------
[2015-09-16 10:23:42] col dot shrapnel at gmail dot com
Come on, close it as bogus already.
To get an exception one have to move over resultsets, using nextRowset(), which is the proper way,
not a "workaround" as someone called it.
------------------------------------------------------------------------
[2015-08-02 09:19:13] fekiri_malek at hotmail dot com
i have the same problem with php 5.5.12 on windows 7 x86
------------------------------------------------------------------------
[2015-06-16 15:51:21] blaimi at blaimi dot de
I'm using this as workaround:
$pdo->beginTransaction();
try {
$statement = $pdo->prepare($sql);
$statement->execute();
while ($statement->nextRowset()) {/* https://bugs.php.net/bug.php?id=61613 */};
$pdo->commit();
} catch (\PDOException $e) {
$pdo->rollBack();
throw $e;
}
------------------------------------------------------------------------
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