libpqxx  7.9.0
Transaction classes

Classes

class  pqxx::dbtransaction
 Abstract transaction base class: bracket transactions on the database. More...
 
class  pqxx::nontransaction
 Simple "transaction" class offering no transactional integrity. More...
 
class  pqxx::robusttransaction< ISOLATION >
 Slightly slower, better-fortified version of transaction. More...
 
class  pqxx::subtransaction
 "Transaction" nested within another transaction More...
 
class  pqxx::transaction< ISOLATION, READWRITE >
 Standard back-end transaction, templatised on isolation level. More...
 
class  pqxx::transaction_base
 Interface definition (and common code) for "transaction" classes. More...
 

Detailed Description

All database access goes through instances of these classes. However, not all implementations of this interface need to provide full transactional integrity.

You'll find several implementations of this interface in libpqxx, including the plain transaction class, the entirely unprotected nontransaction, and the more cautious robusttransaction.

Like most other things in libpqxx, transactions follow RAII principles: creating a transaction object means to start the transaction, and to destroy it means to end the transaction. But there's one extra step: if you want to make the transaction's changes permanent, you need to commit it at the end. If you destroy the transaction object without committing it, or if you call its abort() member function, then the transaction will roll back its effects instead.

The big exception to all this is nontransaction. It gives you the transaction API but without actually starting a transaction on the database.