|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-04-03 22:57 UTC] trebitzki at gmx dot net
Description:
------------
I am submitting a group of two SQL statements to PDO. The first is valid, the second has a syntax error. PDO should throw an exception but doesn't. It only throws an exception when the first statement is invalid.
Test script:
---------------
//[symfony 1.4 environment]
$conn = Propel::getConnection();
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo_statement = $conn->prepare('SELECT 1; invalidstatement');
$pdo_statement->execute();
Expected result:
----------------
I expect to have an error thrown since the group of statements has a syntax error.
Actual result:
--------------
No error is thrown.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 05:00:01 2025 UTC |
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; }