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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to