Bug #66621 [Com]: PDO::commit() bug
| From: | enrico_kaelert at kabelmail dot de | Date: | Tue, 25 Feb 2014 18:20:59 +0000 |
| Subject: | Bug #66621 [Com]: PDO::commit() bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-184428@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66621&edit=1
ID: 66621
Comment by: enrico_kaelert at kabelmail dot de
Reported by: enrico_kaelert at kabelmail dot de
Summary: PDO::commit() bug
Status: Open
Type: Bug
Package: PDO MySQL
Operating System: Windows 7 64bit
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Forget about the part:
"
Weird:
If you look at the SELECT (# 4.) you can see that we get "fake"(?)-results back.
On every run the AUTO_INCREMENT counts up which is real - so those ids get lost.
"
Of curse the queries was sent to the sql server, auto_increment counted up (see docu dev.mysql.com).
The INSERTS/UPDATES/.. are not committed, so i guess we are getting the data out of temp tbls.
Previous Comments:
------------------------------------------------------------------------
[2014-02-01 00:56:37] enrico_kaelert at kabelmail dot de
Description:
------------
Trying to keep it short:
System:
Win7 64bit, xampp (MySQL Server Version: 5.6.14 PHP Version: 5.5.6)
Also tried that on a different system with (i think) PHP Version 5.8
The case:
using PDO to fire more than 1 INSERT INTO via PDO::beginTransaction() and PDO::commit()
The bug:
if i DO NOT set $stmt to "what ever", then the PDO::commit() has no effect.
But if i change $stmt to a string, a number or null - anything else but itself - then all INSERTs
are fired up.
Weird to describe.
Just see the test script at "# 3. ..." (line 43) where the "magic" happens.
To switch between the "working version" and the "bug version" simple change the
if(1) to if(0) ...
"bug version"
$stmt is a prepared query which was just executed.
Because we did a $dbh->beginTransaction(); we do now fire a $dbh->commit();
But ... no action has been taken @db - no inserts made.
This only seem to happen if you fire MORE than 1 INSERT at 1 query.
"working version"
The ONLY different here is that we set $stmt to something else.
$stmt is of curse the current prepared and executed query.
Now BEFORE we fire the $dbh->commit() we do: $stmt = 'anything else';
And - its magic - the following $dbh->commit() works :: all INSERTs are done.
Weird:
If you look at the SELECT (# 4.) you can see that we get "fake"(?)-results back.
On every run the AUTO_INCREMENT counts up which is real - so those ids get lost.
Thanks for you time - coulndt do it shorter.
Was looking into that problem for hours today with a friend =)
Test script:
---------------
detailed test script: http://pastebin.com/1QEcnPhM
Expected result:
----------------
explained in the description
Actual result:
--------------
explained in the description
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66621&edit=1