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

From: Date: Sun, 26 Nov 2023 02:30:40 +0000
Subject: [PDO] I want to unify the behavior when changing the autocommit mode setting while a transaction is open.
Groups: php.internals 
Request: Send a blank email to internals+get-121811@lists.php.net to get a copy of this message
Hi internals, The following code: ``` $db = new PDO(/* omission */, [PDO::ATTR_ATUOCOMMIT => 0]); $db->beginTransaction(); $db->setAttribute(PDO::ATTR_ATUOCOMMIT, 1); ``` 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. Regards. Saki

« previous php.internals (#121811) next »