From:             james at kenjim dot com
Operating system: All
PHP version:      master-Git-2012-12-05 (Git)
Package:          PDO related
Bug Type:         Bug
Bug description:Problems with a manual transaction while auto commit is enabled.

Description:
------------
The documentation at http://php.net/manual/en/pdo.transactions.php gives me
the impression that the default mode a pdo db driver is in is auto-commit. 
If I choose to create a batch of queries in one transaction I can do so by
first issuing a begin transaction.  This however does not appear to be the
case when looking at the c code for all but the odbc pdo driver. 
Auto-commit is never actually disabled so all my queries in my transaction
block get committed when they get executed.  I have only tested this
behavior with Firebird.

I have created a patch that will turn off auto-commit at the driver level
when beginTransaction is called and will restore the user setting when
commit or rollback is called.  This way all pdo drivers that support
transactions and auto-commit should now act properly.  The patch also
includes the ability to support commits/rollbacks that keep the transaction
open.  Also included in this patch is my patch from Request #63215 since I
realized that patch needed pdo to support the ability to keep a transaction
open after calling commit/rollback.

Please note my patch was only tested with the Firebird database driver so
other database drivers should have their beginTransaction with auto-commit
on functionality tested.



-- 
Edit bug report at https://bugs.php.net/bug.php?id=63690&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63690&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63690&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63690&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63690&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63690&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63690&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63690&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63690&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63690&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63690&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63690&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63690&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63690&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63690&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63690&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63690&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63690&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63690&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63690&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63690&r=mysqlcfg

Reply via email to