robusttransaction.hxx

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  *   FILE
00004  *      pqxx/robusttransaction.hxx
00005  *
00006  *   DESCRIPTION
00007  *      definition of the pqxx::robusttransaction class.
00008  *   pqxx::robusttransaction is a slower but safer transaction class
00009  *   DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/robusttransaction instead.
00010  *
00011  * Copyright (c) 2002-2006, Jeroen T. Vermeulen <jtv@xs4all.nl>
00012  *
00013  * See COPYING for copyright license.  If you did not receive a file called
00014  * COPYING with this source code, please notify the distributor of this mistake,
00015  * or contact the author.
00016  *
00017  *-------------------------------------------------------------------------
00018  */
00019 #include "pqxx/compiler-public.hxx"
00020 #include "pqxx/compiler-internal-pre.hxx"
00021 
00022 #include "pqxx/dbtransaction"
00023 
00024 
00025 /* Methods tested in eg. self-test program test001 are marked with "//[t1]"
00026  */
00027 
00028 
00029 namespace pqxx
00030 {
00031 
00038 class PQXX_LIBEXPORT basic_robusttransaction : public dbtransaction
00039 {
00040 public:
00042   typedef isolation_traits<read_committed> isolation_tag;
00043 
00044   virtual ~basic_robusttransaction() =0;                                //[t16]
00045 
00046 protected:
00047   basic_robusttransaction(connection_base &C,
00048         const PGSTD::string &IsolationLevel);                           //[t16]
00049 
00050 private:
00051   typedef unsigned long IDType;
00052   IDType m_ID;
00053   PGSTD::string m_LogTable;
00054   int m_backendpid;
00055 
00056   virtual void do_begin();                                              //[t18]
00057   virtual void do_commit();                                             //[t16]
00058   virtual void do_abort();                                              //[t18]
00059 
00060   void PQXX_PRIVATE CreateLogTable();
00061   void PQXX_PRIVATE CreateTransactionRecord();
00062   void PQXX_PRIVATE DeleteTransactionRecord(IDType ID) throw ();
00063   bool PQXX_PRIVATE CheckTransactionRecord(IDType ID);
00064 };
00065 
00066 
00067 
00069 
00135 template<isolation_level ISOLATIONLEVEL=read_committed>
00136 class robusttransaction : public basic_robusttransaction
00137 {
00138 public:
00139   typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00140 
00142 
00146   explicit robusttransaction(connection_base &C,
00147       const PGSTD::string &Name=PGSTD::string()) :
00148     namedclass(fullname("robusttransaction",isolation_tag::name()), Name),
00149     basic_robusttransaction(C, isolation_tag::name())
00150         { Begin(); }
00151 
00152   virtual ~robusttransaction() throw ()
00153   {
00154 #ifdef PQXX_QUIET_DESTRUCTORS
00155     internal::disable_noticer Quiet(conn());
00156 #endif
00157     End();
00158   }
00159 };
00160 
00165 } // namespace pqxx
00166 
00167 
00168 #include "pqxx/compiler-internal-post.hxx"

Generated on Thu Feb 1 17:12:08 2007 for libpqxx by  doxygen 1.5.1