Hướng dẫn php intransaction

[PHP 5 >= 5.3.3, Bundled pdo_pgsql, PHP 7, PHP 8]

PDO::inTransaction Checks if inside a transaction

Description

public PDO::inTransaction[]: bool

Parameters

This function has no parameters.

Return Values

Returns true if a transaction is currently active, and false if not.

jlh

2 years ago

Important note: This will only detect whether a transaction has been started using beginTransaction[]. It will not be able to detect transactions started by any other means, for example by executing "START TRANSACTION".

Anonymous

2 years ago

In addition to what jlh says,
even with SQLite3 which automatically starts transaction,
inTransaction[] only works after beginTransaction[].

Chủ Đề