php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63690 Problems with a manual transaction while auto commit is enabled.
Submitted: 2012-12-05 07:15 UTC Modified: 2018-07-15 04:22 UTC
Votes:6
Avg. Score:4.2 ± 1.2
Reproduced:5 of 6 (83.3%)
Same Version:3 (60.0%)
Same OS:2 (40.0%)
From: james at kenjim dot com Assigned:
Status: No Feedback Package: PDO Firebird
PHP Version: master-Git-2012-12-05 (Git) OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: james at kenjim dot com
New email:
PHP Version: OS:

 

 [2012-12-05 07:15 UTC] james at kenjim dot com
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.



Patches

PDO_Transaction_During_AutoCommit_and_Commit_Continue_Support (last revision 2012-12-05 07:16 UTC by james at kenjim dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-22 16:11 UTC] mariuz@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mariuz
 [2014-01-01 12:35 UTC] felipe@php.net
-Package: PDO related +Package: PDO Firebird
 [2017-10-24 06:45 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: mariuz +Assigned To:
 [2018-07-06 19:08 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2018-07-06 19:08 UTC] ab@php.net
@james, thanks for the patch. If you're still on the topic, please consider making a PR or updating the patch suitable for the current master, also including tests covering the functionality. Otherwise, if anyone else is interested on this, please take over the ticket.

Thanks.
 [2018-07-15 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC