--- /dev/null
+# class pq\Transaction
+
+A database transaction.
+
+> ***NOTE:***
+ Transactional properties like pq\Transaction::$isolation, pq\Transaction::$readonly and pq\Transaction::$deferrable can be changed after the transaction begun and the first query has been executed. Doing this will lead to appropriate `SET TRANSACTION` queries.
+
+## Constants:
+
+* READ_COMMITTED
+ Transaction isolation level where only rows committed before the transaction began can be seen.
+* REPEATABLE_READ
+ Transaction isolation level where only rows committed before the first query was executed in this transaction.
+* SERIALIZABLE
+ Transaction isolation level that guarantees serializable repeatability which might lead to serialization_failure on high concurrency.
+
+## Properties:
+
+* public (readonly) pq\Connection $connection
+ The connection the transaction was started on.
+* public int $isolation = pq\Transaction::READ_COMMITTED
+ The transaction isolation level.
+* public bool $readonly = FALSE
+ Whether this transaction performs read only queries.
+* public bool $deferrable = FALSE
+ Whether the transaction is deferrable. See pq\Connection::startTransaction().
+
--- /dev/null
+# void pq\Transaction::__construct(pq\Connection $conn[, bool $async = FALSE[, int $isolation = pq\Transaction::READ_COMMITTED[, bool $readonly = FALSE[, bool $deferrable = FALSE]]]])
+
+Start a transaction.
+See pq\Connection::startTransaction().
+
+## Params:
+
+* pq\Connection $conn
+ The connection to start the transaction on.
+* Optional bool $async = FALSE
+ Whether to start the transaction [asynchronously](pq/Connection/: Asynchronous Usage).
+* Optional int $isolation = pq\Transaction::READ_COMMITTED
+ The transaction isolation level (defaults to pq\Connection::$defaultTransactionIsolation).
+* Optional bool $readonly = FALSE
+ Whether the transaction is readonly (defaults to pq\Connection::$defaultTransactionReadonly).
+* Optional bool $deferrable = FALSE
+ Whether the transaction is deferrable (defaults to pq\Connection::$defaultTransactionDeferrable).
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
+
+
+## Example:
+
+ <?php
+
+ $connection = new pq\Connection;
+ $transaction = new pq\Transaction(
+ $connection, FALSE, pq\Transaction::REPEATABLE_READ);
+
+ ?>
--- /dev/null
+# void pq\Transaction::commit()
+
+Commit the transaction or release the previous savepoint.
+See pq\Transaction::savepoint().
+
+## Params:
+
+None.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
+* pq\Exception\DomainException
--- /dev/null
+# void pq\Transaction::commitAsync()
+
+[Asynchronously](pq/Connection/: Asynchronous Usage) commit the transaction or release the previous savepoint.
+See pq\Transaction::commit() and pq\Transaction::savepoint().
+
+## Params:
+
+None.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
--- /dev/null
+# pq\LOB pq\Transaction::createLOB([int $mode = pq\LOB::RW])
+
+Create a new *large object* and open it.
+See pq\Transaction::openLOB().
+
+## Params:
+
+* Optional int $mode = pq\LOB::RW
+ How to open the *large object* (read, write or both; see pq\LOB constants).
+
+## Returns:
+
+* pq\LOB, instance of the new *large object*.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
+
+## Example:
+
+ <?php
+
+ $connection = new pq\Connection;
+ $transaction = $connection->startTransaction();
+
+ $lob = $transaction->createLOB();
+ $lob->write("Hello World!");
+
+ // close the LOB before unlinking
+ $oid = $lob->oid;
+ $lob = null;
+
+ $transaction->unlinkLOB($oid);
+ $transaction->commit();
+
+ ?>
--- /dev/null
+# void pq\Transaction::exportLOB(int $oid, string $path)
+
+Export a *large object* to a local file.
+See pq\Transaction::importLOB().
+
+## Params:
+
+* int $oid
+ The OID of the *large object*.
+* string $path
+ The path of a local file to export to.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
--- /dev/null
+# string pq\Transaction::exportSnapshot()
+
+Export a snapshot for transaction synchronization.
+See pq\Transaction::importSnapshot().
+
+## Params:
+
+None.
+
+## Returns:
+
+* string, the snapshot idfentifier usabel with pq\Transaction::importSnapshot().
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
+* pq\Exception\DomainException
--- /dev/null
+# void pq\Transaction::exportSnapshotAsync()
+
+[Asynchronously](pq/Connection/: Asynchronous Usage) export a snapshot for transaction synchronization.
+See pq\Transaction::exportSnapshot().
+
+## Params:
+
+None.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
--- /dev/null
+# int pq\Transaction::importLOB(string $local_path[, int $oid = 0)
+
+Import a local file into a *large object*.
+
+## Params:
+
+* string $local_path
+ A path to a local file to import.
+* Optional int $oid = 0
+ The target OID. A new *large object* will be created if empty.
+
+## Returns:
+
+* int, the (new) OID of the *large object*.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
+
+## Example:
+
+ <?php
+
+ $connection = new pq\Connection;
+ $transaction = $connection->startTransaction();
+
+ $oid = $transaction->importLOB(__FILE__);
+ $lob = $transaction->openLOB($oid);
+
+ var_dump($lob);
+
+ ?>
+
+Yields:
+
+ object(pq\LOB)#5 (3) {
+ ["transaction"]=> {
+ ...
+ }
+ ["oid"]=>
+ int(74492)
+ ["stream"]=>
+ resource(6) of type (stream)
+ }
--- /dev/null
+# void pq\Transaction::importSnapshot(string $snapshot_id)
+
+Import a snapshot from another transaction to synchronize with.
+See pq\Transaction::exportSnapshot().
+
+> ***NOTE:***
+ The transaction must have an isolation level of at least pq\Transaction::REPEATABLE_READ.
+
+## Params:
+
+* string $snapshot_id
+ The snapshot identifier obtained by exporting a snapshot from a transaction.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
+* pq\Exception\DomainException
--- /dev/null
+# void pq\Transaction::importSnapshotAsync(string $snapshot_id)
+
+[Asynchronously](pq/Connection/: Asynchronous Usage) import a snapshot from another transaction to synchronize with.
+See pq\Transaction::importSnapshot().
+
+> ***NOTE:***
+ The transaction must have an isolation level of at least pq\Transaction::REPEATABLE_READ.
+
+## Params:
+
+* string $snapshot_id
+ The snapshot identifier obtained by exporting a snapshot from a transaction.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
--- /dev/null
+# pq\LOB pq\Transaction::openLOB(int $oid[, int $mode = pq\LOB::RW])
+
+Open a *large object*.
+See pq\Transaction::createLOB().
+
+## Params:
+
+* int $oid
+ The OID of the *large object*.
+* Optional int $mode = pq\LOB::RW
+ Operational mode; read, write or both.
+
+## Returns:
+
+* pq\LOB, instance of the opened *large object*.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
--- /dev/null
+# void pq\Transaction::rollback()
+
+Rollback the transaction or to the previous savepoit within this transction.
+See pq\Transaction::commit() and pq\Transaction::savepoint().
+
+## Params:
+
+None.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
+* pq\Exception\DomainException
+
--- /dev/null
+# void pq\Transaction::rollbackAsync()
+
+[Asynchronously](pq/Connection/: Asynchronous Usage) rollback the transaction or to the previous savepoit within this transction.
+See pq\Transaction::rollback() and pq\Transaction::savepoint().
+
+## Params:
+
+None.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
+
--- /dev/null
+# void pq\Transaction::savepoint()
+
+Create a `SAVEPOINT` within this transaction.
+
+> ***NOTE:***
+ pq\Transaction tracks an internal counter as savepoint identifier.
+
+## Params:
+
+None.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException
+
+
+## Example:
+
+ <?php
+
+ $connection = new pq\Connection;
+ $transaction = $connection->startTransaction();
+
+ // create a savepoint
+ $transaction->savepoint();
+ // create another savepoint
+ $transaction->savepoint();
+
+ // rollback to previous savepoint
+ $transaction->rollback();
+ // release first savepoint
+ $transaction->commit();
+ // commit transaction
+ $transaction->commit();
+
+ ?>
--- /dev/null
+# void pq\Transaction::savepointAsync()
+
+[Asynchronously](pq/Connection/: Asynchronous Usage) create a `SAVEPOINT` within this transaction.
+See pq\Transaction::savepoint().
+
+## Params:
+
+None.
+
+## Throws:
+
+* pq\Exception\InvalidArgumentException
+* pq\Exception\BadMethodCallException
+* pq\Exception\RuntimeException