On 09-06-2022 15:29, Jan Derk Stegeman wrote:
> I filed a bug report with PHP PDO
> <
https://github.com/php/php-src/issues/8735> that begintransaction
> raises an "transaction already exists exception" if a query has been
> performed before calling begintransaction. The PHP documentation
> <
https://www.php.net/manual/en/pdo.begintransaction.php> states that
> begintransaction should turn off autocommit, which is not what is happening.
>
> Looks like in autocommit mode a transaction is always committed and
> retained for any query. My workaround has been to disable autocommit
> before the begintransaction part and reenable after commit or rollback.
>
> My question: Is this a bug in the PDO driver? This goes over my head.
>
> Any expert that could chime in on the PHP bug report so things get
> straightened out is very welcome. Looks to the non-expert, me, like this
> is a bug. But maybe it just should get documented better.
This is a question that might be more suitable to ask on the
firebird-php Google Group (
https://groups.google.com/g/firebird-php).
However, yes it sounds like a bug, something they confirmed in your bug
report. The "Firebird driver" mentioned by cmb69 is pdo-firebird
(
https://github.com/php/php-src/tree/master/ext/pdo_firebird).
The problem is that Firebird itself doesn't have a suitable auto-commit
mode that automatically starts and completes transactions when
necessary, so a driver must handle starting and completingtransactions
for auto-commit itself, and the way pdo-firebird does this, doesn't
handle the requirements documented for PDO's beginTransaction.
Mark
--
Mark Rotteveel