Bug #61613 [Com]: No PDO error if first SQL statement of a group is valid.

From: Date: Wed, 16 Sep 2015 11:53:28 +0000
Subject: Bug #61613 [Com]: No PDO error if first SQL statement of a group is valid.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196038@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61613&edit=1 ID: 61613 Comment by: Daniel at Kraffner dot de 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: 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. Previous Comments: ------------------------------------------------------------------------ [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; } ------------------------------------------------------------------------ [2015-04-14 14:12:42] mikhail dot v dot gavrilov at gmail dot com This bug still not fixed in PHP 5.6.7 Linux Fedora 21 ------------------------------------------------------------------------ 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

« previous php.bugs (#196038) next »