Re: [PDO] I want to unify the behavior when changing the autocommit mode setting while a transaction is open.

From: Date: Mon, 27 Nov 2023 08:58:49 +0000
Subject: Re: [PDO] I want to unify the behavior when changing the autocommit mode setting while a transaction is open.
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-121813@lists.php.net to get a copy of this message
Hi Saki, Il 26/11/2023 03:30, Saki Takamachi ha scritto:
The behavior in this case varies depending on the DB driver and is not unified. MySQL, OCI, ODBC, and Firebird currently support PDO autocommit mode. - MySQL always sets the new mode regardless of the state of the transaction, resulting in an implicit commit. - OCI does an explicit commit and sets the new autocommit mode. - Firebird raises an error. - ODBC does not implement this behavior in the first place (it is a bug) I believe that code that changes the autocommit mode with a transaction open is usually just forgetting to close the transaction. Therefore, in such cases, I would like to unify the behavior by generating an error like Firebird. I would appreciate any feedback on this proposal and whether this change requires an RFC.
PDO's main goal was to make building db drivers easier, and it's not meant to be a full DB abstraction layer. As such, it is not expected that all databases behave the same, especially for exotic functionality, such as autocommit. My 2c Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/

« previous php.internals (#121813) next »