robusttransaction.hxx
/*-------------------------------------------------------------------------
*
* FILE
* pqxx/robusttransaction.hxx
*
* DESCRIPTION
* definition of the pqxx::robusttransaction class.
* pqxx::robusttransaction is a slower but safer transaction class
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/robusttransaction instead.
*
* Copyright (c) 2002-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_ROBUSTTRANSACTION
#define PQXX_H_ROBUSTTRANSACTION
#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 test001 are marked with "//[t1]"
*/
namespace pqxx
{
class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction :
public dbtransaction
{
public:
typedef isolation_traits<read_committed> isolation_tag;
virtual ~basic_robusttransaction() =0; //[t16]
protected:
basic_robusttransaction(
connection_base &C,
const PGSTD::string &IsolationLevel,
const PGSTD::string &table_name=PGSTD::string()); //[t16]
private:
typedef unsigned long IDType;
IDType m_record_id;
PGSTD::string m_xid;
PGSTD::string m_LogTable;
PGSTD::string m_sequence;
int m_backendpid;
virtual void do_begin(); //[t18]
virtual void do_commit(); //[t16]
virtual void do_abort(); //[t18]
void PQXX_PRIVATE CreateLogTable();
void PQXX_PRIVATE CreateTransactionRecord();
PGSTD::string PQXX_PRIVATE sql_delete() const;
void PQXX_PRIVATE DeleteTransactionRecord() throw ();
bool PQXX_PRIVATE CheckTransactionRecord();
};
template<isolation_level ISOLATIONLEVEL=read_committed>
class robusttransaction : public basic_robusttransaction
{
public:
typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
explicit robusttransaction(connection_base &C,
const PGSTD::string &Name=PGSTD::string()) :
namedclass(fullname("robusttransaction",isolation_tag::name()), Name),
basic_robusttransaction(C, isolation_tag::name())
{ Begin(); }
virtual ~robusttransaction() throw ()
{
#ifdef PQXX_QUIET_DESTRUCTORS
quiet_errorhandler quiet(conn());
#endif
End();
}
};
} // namespace pqxx
#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::quiet_errorhandler
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:85
pqxx::robusttransaction::~robusttransaction
virtual ~robusttransaction()
Definition: robusttransaction.hxx:165
pqxx::robusttransaction::isolation_tag
isolation_traits< ISOLATIONLEVEL > isolation_tag
Definition: robusttransaction.hxx:152
pqxx::read_committed
Definition: isolation.hxx:63
pqxx::robusttransaction
Slightly slower, better-fortified version of transaction.
Definition: robusttransaction.hxx:149
pqxx::robusttransaction::robusttransaction
robusttransaction(connection_base &C, const std::string &Name=std::string())
Constructor.
Definition: robusttransaction.hxx:159
pqxx::isolation_level
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:60
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
pqxx::basic_robusttransaction::isolation_tag
isolation_traits< read_committed > isolation_tag
Isolation level is read_committed by default.
Definition: robusttransaction.hxx:50
pqxx::basic_robusttransaction
Definition: robusttransaction.hxx:45