Bug #65994 [NEW]: PDO::prepare() with multi-queries doesn't work inside a transaction
From: pedro at sancao dot com dot br
Operating system: Linux/Windows
PHP version: 5.4.21
Package: PDO related
Bug Type: Bug
Bug description:PDO::prepare() with multi-queries doesn't work inside a transaction
Description:
------------
Using PDO on MySQL 5.5.32 (Linux and Windows)
When executing a prepared multi-query statement after calling
PDO::beginTransaction() the PDO::commit() will return true but no commit
will be done.
Also the affected tables will be locked until the database server is
restarted.
Nor error is raised neither exception is thrown.
My tests was within a try/catch block.
Test script:
---------------
$pdo = new
PDO('mysql:dbname=PLACE_DATABASE;host=localhost;charset=utf8',
'PLACE_USER', 'PLACE_PASSWORD', array(
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ
));
try {
$pdo->beginTransaction();
$statement = $pdo->prepare('UPDATE ...; UPDATE ...; ');
$statement->execute();
$pdo->commit();
} catch (PDOException $e) {
exit($e->getMessage());
$pdo->rollBack();
}
--
Edit bug report at https://bugs.php.net/bug.php?id=65994&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65994&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65994&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65994&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65994&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65994&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65994&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65994&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65994&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65994&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65994&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=65994&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=65994&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65994&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65994&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65994&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65994&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65994&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65994&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65994&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65994&r=mysqlcfg
Thread (4 messages)
- pedro at sancao dot com dot br