# pqxx::transaction< ISOLATIONLEVEL > Class Template Reference
[Transaction classes]

Standard back-end transaction, templatized on isolation level. More...

`#include <transaction.hxx>`

Inheritance diagram for pqxx::transaction< ISOLATIONLEVEL >:

[legend]

List of all members.

## Public Types
typedef isolation_traits < ISOLATIONLEVEL > | isolation_tag
| If nothing else is known, our isolation level is at least read_committed.
## Public Member Functions
| transaction (connection_base &C, const std::string &TName)
| Create a transaction.
| transaction (connection_base &C)
virtual | ~transaction () throw ()

## Detailed Description

### template<isolation_level ISOLATIONLEVEL = read_committed>
class pqxx::transaction< ISOLATIONLEVEL >

Standard back-end transaction, templatized on isolation level.

This is the type you'll normally want to use to represent a transaction on the database.

While you may choose to create your own transaction object to interface to the database backend, it is recommended that you wrap your transaction code into a transactor code instead and let the transaction be created for you.

See also:
  pqxx/transactor.hxx

If you should find that using a transactor makes your code less portable or too complex, go ahead, create your own transaction anyway.

Usage example: double all wages

     extern connection C;
     work T(C);
     try
     {
       T.exec("UPDATE employees SET wage=wage*2");
       T.commit();  // NOTE: do this inside try block
     }
     catch (const exception &e)
     {
       cerr << e.what() << endl;
       T.abort();           // Usually not needed; same happens when T's life ends.
     }

## Member Typedef Documentation

template<isolation_level ISOLATIONLEVEL = read_committed>

typedef isolation_traits<ISOLATIONLEVEL> pqxx::transaction< ISOLATIONLEVEL >::isolation_tag

If nothing else is known, our isolation level is at least read_committed.

Reimplemented from pqxx::transaction_base.

## Constructor & Destructor Documentation

template<isolation_level ISOLATIONLEVEL = read_committed>

pqxx::transaction< ISOLATIONLEVEL >::transaction | ( | connection_base & | C,
|  | const std::string & | TName |
| ) |  |  | `[explicit]`

Create a transaction.

Parameters:

  | C | Connection for this transaction to operate on
  | TName | Optional name for transaction; must begin with a letter and may contain letters and digits only

References pqxx::transaction_base::Begin().

template<isolation_level ISOLATIONLEVEL = read_committed>

pqxx::transaction< ISOLATIONLEVEL >::transaction | ( | connection_base & | C | ) | `[explicit]`

References pqxx::transaction_base::Begin().

template<isolation_level ISOLATIONLEVEL = read_committed>

virtual pqxx::transaction< ISOLATIONLEVEL >::~transaction | ( |  | ) | throw ()`[virtual]`

References pqxx::transaction_base::conn(), and pqxx::transaction_base::End().

The documentation for this class was generated from the following file:

- transaction.hxx