pg_transaction_status

PHP 5 >= 5.1.0, PHP 7, PHP 8
pg_transaction_status - Returns the current in-transaction status of the server
Manual
Code Examples

pg_transaction_status( PgSql\Connection$connection ): int

Returns the current in-transaction status of the server.

Caution:

pg_transaction_status will give incorrect results when using a PostgreSQL 7.3 server that has the parameter autocommit set to off. The server-side autocommit feature has been deprecated and does not exist in later server versions.

Parameters

connection

An PgSql\Connection instance.

Return Values

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.

Changelog

Version Description
8.1.0 The connection parameter expects an PgSql\Connection instance now; previously, a resource was expected.

Example of pg_transaction_status

Show all examples for pg_transaction_status

PHP Version:


Function pg_transaction_status:

PostgreSQL Functions

Most used PHP functions