transaction.hxx
/*-------------------------------------------------------------------------
*
* FILE
* pqxx/transaction.hxx
*
* DESCRIPTION
* definition of the pqxx::transaction class.
* pqxx::transaction represents a standard database transaction
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transaction instead.
*
* Copyright (c) 2001-2011, Jeroen T. Vermeulen <jtv@xs4all.nl>
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
* or contact the author.
*
*-------------------------------------------------------------------------
*/
#ifndef PQXX_H_TRANSACTION
#define PQXX_H_TRANSACTION
#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"
#include "pqxx/dbtransaction"
#ifdef PQXX_QUIET_DESTRUCTORS
#include "pqxx/errorhandler"
#endif
/* Methods tested in eg. self-test program test1 are marked with "//[t1]"
*/
namespace pqxx
{
class PQXX_LIBEXPORT basic_transaction : public dbtransaction
{
protected:
basic_transaction( //[t1]
connection_base &C,
const PGSTD::string &IsolationLevel,
readwrite_policy);
private:
virtual void do_commit(); //[t1]
};
template<
isolation_level ISOLATIONLEVEL=read_committed,
readwrite_policy READWRITE=read_write>
class transaction : public basic_transaction
{
public:
typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
explicit transaction(connection_base &C, const PGSTD::string &TName): //[t1]
namedclass(fullname("transaction", isolation_tag::name()), TName),
basic_transaction(C, isolation_tag::name(), READWRITE)
{ Begin(); }
explicit transaction(connection_base &C) : //[t1]
namedclass(fullname("transaction", isolation_tag::name())),
basic_transaction(C, isolation_tag::name(), READWRITE)
{ Begin(); }
virtual ~transaction() throw ()
{
#ifdef PQXX_QUIET_DESTRUCTORS
quiet_errorhandler quiet(conn());
#endif
End();
}
};
typedef transaction<> work;
typedef transaction<read_committed, read_only> read_transaction;
}
#include "pqxx/compiler-internal-post.hxx"
#endif
pqxx::isolation_traits
Traits class to describe an isolation level; primarly for libpqxx&#39;s own use.
Definition: isolation.hxx:69
pqxx::connection_base
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:151
pqxx::dbtransaction
Definition: dbtransaction.hxx:73
pqxx::read_transaction
transaction< read_committed, read_only > read_transaction
Read-only transaction.
Definition: transaction.hxx:125
pqxx::quiet_errorhandler
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:85
pqxx::basic_transaction
Definition: transaction.hxx:45
pqxx::read_committed
Definition: isolation.hxx:63
pqxx::readwrite_policy
readwrite_policy
Definition: dbtransaction.hxx:30
pqxx::transaction::transaction
transaction(connection_base &C, const std::string &TName)
Create a transaction.
Definition: transaction.hxx:101
pqxx::transaction::isolation_tag
isolation_traits< ISOLATIONLEVEL > isolation_tag
Definition: transaction.hxx:93
pqxx::work
transaction work
Bog-standard, default transaction type.
Definition: transaction.hxx:122
pqxx::transaction::~transaction
virtual ~transaction()
Definition: transaction.hxx:111
pqxx::isolation_level
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:60
pqxx::transaction::transaction
transaction(connection_base &C)
Definition: transaction.hxx:106
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
pqxx::transaction
Standard back-end transaction, templatized on isolation level.
Definition: transaction.hxx:90
pqxx::read_write
Definition: dbtransaction.hxx:33