[php-src] PR #12815: Feature: Add transaction isolation level and mode settings to `pdo_firebird`

From: Date: Tue, 28 Nov 2023 14:21:03 +0000
Subject: [php-src] PR #12815: Feature: Add transaction isolation level and mode settings to `pdo_firebird`
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-24354@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/12815 Author: SakiTakamachi take2 of #12664 ## About Firebird transaction isolation levels Firebird's transaction isolation level can only be set at the beginning of a transaction. Therefore, we saved the user's settings on the php side and used them when starting a transaction. Default is repeatable lead. ### Firebird's read committed has three types of behavior 1. Load committed data. It works the same as MySQL etc. 2. If there is in-doubt data that has not yet been committed, wait until it is committed or rolled back. 3. If there is in-doubt data that has not yet been committed, it immediately raises an error as a deadlock. For this pull request, I adopted 1, which is a common read committed. It is possible to switch between 2 and 3 by attribute value, but I have decided that there is no need to implement it yet as I do not know the demand. ## About access mode There are writable and read-only modes. Like isolation levels, this can only be set at the beginning of a transaction. In the same way, the setting value is retained on the php side. Default is writable. ## Auto commit mode Firebird's autocommit mode is emulated by PHP, which actually always has a transaction open. If a transaction in autocommit mode is run at a high isolation level, it will not be able to read any changes made by other transactions after new PDO(). ``` <?php $db = new PDO(/**/); $db_other = new PDO(/**/); $db_other->exec('CREATE TABLE test (val INT)'); $db->query('SELECT * FROM test'); ``` ``` Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: -204 Dynamic SQL Error SQL error code = -204 Table unknown TEST At line 1, column 15 in <path to file>:7 Stack trace: #0 /mount/ft.php(7): PDO->exec('SELECT * FROM t...') #1 {main} thrown in <path to file> on line 7 ``` Therefore, I made the autocommit mode to always work with read committed, regardless of the user's configured value.

« previous php.git-pulls (#24354) next »