Bug #63690 [Opn->Fbk]: Problems with a manual transaction while auto commit is enabled.

From: Date: Fri, 06 Jul 2018 19:08:47 +0000
Subject: Bug #63690 [Opn->Fbk]: Problems with a manual transaction while auto commit is enabled.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216186@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63690&edit=1

 ID:                 63690
 Updated by:         ab@php.net
 Reported by:        james at kenjim dot com
 Summary:            Problems with a manual transaction while auto commit
                     is enabled.
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            PDO Firebird
 Operating System:   All
 PHP Version:        master-Git-2012-12-05 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

@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.


Previous Comments:
------------------------------------------------------------------------
[2012-12-05 07:15:53] 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.




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=63690&edit=1


Thread (5 messages)

« previous php.bugs (#216186) next »