Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

pqxx::dbtransaction Class Reference

Abstract base class responsible for bracketing a backend transaction. More...

#include <dbtransaction.hxx>

Inheritance diagram for pqxx::dbtransaction:

pqxx::transaction_base pqxx::internal::namedclass pqxx::basic_robusttransaction pqxx::basic_transaction pqxx::robusttransaction< ISOLATIONLEVEL > pqxx::transaction< ISOLATIONLEVEL > List of all members.

Protected Member Functions

 dbtransaction (connection_base &, const PGSTD::string &IsolationString, const PGSTD::string &NName, const PGSTD::string &CName)
void start_backend_transaction ()
 Start a transaction on the backend and set desired isolation level.

Detailed Description

Abstract base class responsible for bracketing a backend transaction.

Use a dbtransaction-derived object such as "work" (transaction<>) to enclose operations on a database in a single "unit of work." This ensures that the whole series of operations either succeeds as a whole or fails completely. In no case will it leave half-finished work behind in the database.

Once processing on a transaction has succeeded and any changes should be allowed to become permanent in the database, call Commit(). If something has gone wrong and the changes should be forgotten, call Abort() instead. If you do neither, an implicit Abort() is executed at destruction time.

It is an error to abort a transaction that has already been committed, or to commit a transaction that has already been aborted. Aborting an already aborted transaction or committing an already committed one has been allowed to make errors easier to deal with. Repeated aborts or commits have no effect after the first one.

Database transactions are not suitable for guarding long-running processes. If your transaction code becomes too long or too complex, please consider ways to break it up into smaller ones. There's no easy, general way to do this since application-specific considerations become important at this point.

The actual operations for beginning and committing/aborting the backend transaction are implemented by a derived class. The implementing concrete class must also call Begin() and End() from its constructors and destructors, respectively, and implement DoExec().


Constructor & Destructor Documentation

pqxx::dbtransaction::dbtransaction connection_base ,
const PGSTD::string &  IsolationString,
const PGSTD::string &  NName,
const PGSTD::string &  CName
[explicit, protected]
 


Member Function Documentation

void pqxx::dbtransaction::start_backend_transaction  )  [protected]
 

Start a transaction on the backend and set desired isolation level.


The documentation for this class was generated from the following files:
Generated on Mon Nov 15 11:28:03 2004 for libpqxx by  doxygen 1.3.9.1