Bug #81227 [Opn]: PDO::inTransaction reports false when in transaction
| From: | cmb@php.net | Date: | Tue, 06 Jul 2021 15:18:15 +0000 |
| Subject: | Bug #81227 [Opn]: PDO::inTransaction reports false when in transaction | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234829@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81227&edit=1
ID: 81227
Updated by: cmb@php.net
Reported by: shariefjamiel at gmail dot com
Summary: PDO::inTransaction reports false when in transaction
Status: Open
Type: Bug
Package: PDO SQLite
Operating System: Ubuntu 20.04
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
PDO_SQLite does not implement an in_txn handler, and so the
transaction status is only tracked according to
PDO::beginTransaction() and friends. To be able to implement the
in_txn handler, we would need to employ the sqlite3_txn_state()
function, which is only available as of SQLite3 3.34.0
(2020-12-01), and still marked as draft in the docs[1].
[1] <https://sqlite.org/draft/c3ref/txn_state.html>
Previous Comments:
------------------------------------------------------------------------
[2021-07-06 14:33:54] shariefjamiel at gmail dot com
Description:
------------
Using PHP 8.0.1 on Ubuntu 20.04 focal
I am executing
BEGIN EXCLUSIVE TRANSACTION due to a locking issue, but the problem is
PDO::inTransaction returns false despite being in a transaction, which leads to errors later on.
Test script:
---------------
$db->exec("BEGIN EXCLUSIVE TRANSACTION");
$alwaysFalse = $db->inTransaction();
Expected result:
----------------
$db->exec("BEGIN EXCLUSIVE TRANSACTION");
$shouldBeTrue = $db->inTransaction();
Actual result:
--------------
$db->exec("BEGIN EXCLUSIVE TRANSACTION");
$false = $db->inTransaction();
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81227&edit=1