userver: uPg: Transactions
No Matches
uPg: Transactions

All queries that are run on a PostgreSQL cluster are executed inside a transaction, even if a single-query interface is used.

A uPg transaction can be started using all isolation levels and modes supported by PostgreSQL server as specified in documentation here When starting a transaction, the options are specified using TransactionOptions structure.

For convenience and improvement of readability there are constants defined: Transaction::RW, Transaction::RO and Transaction::Deferrable.

See also

Transaction object ensures that a transaction started in a PostgreSQL connection will be either committed or rolled back and the connection will returned back to a connection pool.

Code snippet with transaction starting and committing

Next: uPg: Running queries

See also: uPg: Working with result sets