pq\Transaction pq\Connection::startTransaction([int $isolation = pq\Transaction::READ_COMMITTED[, bool $readonly = FALSE[, bool $deferrable = FALSE]]])

Begin a transaction.

Params:

NOTE:
A transaction can only be deferrable if it also is readonly and serializable.
See the official PostgreSQL documentation for further information.

Returns:

Throws:

Example:


<?php

$transaction 
= (new pq\Connection)->startTransaction(
    
pq\Transaction::SERIALIZABLEtruetrue);
$result $transaction->connection->exec(
    
"SELECT * FROM generate_series(1,3)");

?>