Home > PHP > Function > PostgreSQL > pg_transaction_status()

pg_transaction_status()

pg_transaction_status - Returns the current in-transaction status of the server.

Syntax

int pg_transaction_status (resource $connection)

Arguments

  • connection - PostgreSQL database connection resource.

Description

Returns the current in-transaction status of the server.

Version

PHP 5.1.0

Return value

The status can be PGSQL_TRANSACTION_IDLE (currently idle), PGSQL_TRANSACTION_ACTIVE (a command is in progress), PGSQL_TRANSACTION_INTRANS (idle, in a valid transaction block), or PGSQL_TRANSACTION_INERROR (idle, in a failed transaction block). PGSQL_TRANSACTION_UNKNOWN is reported if the connection is bad. PGSQL_TRANSACTION_ACTIVE is reported only when a query has been sent to the server and not yet completed.