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 
00036 
00037 class PQXX_LIBEXPORT basic_robusttransaction : public dbtransaction
00038 {
00039 public:
00041   typedef isolation_traits<read_committed> isolation_tag;
00042 
00043   virtual ~basic_robusttransaction() =0;                                //[t16]
00044 
00045 protected:
00046   basic_robusttransaction(connection_base &C,
00047         const PGSTD::string &IsolationLevel);                           //[t16]
00048 
00049 private:
00050   typedef unsigned long IDType;
00051   IDType m_ID;
00052   PGSTD::string m_LogTable;
00053   int m_backendpid;
00054 
00055   virtual void do_begin();                                              //[t18]
00056   virtual void do_commit();                                             //[t16]
00057   virtual void do_abort();                                              //[t18]
00058 
00059   void PQXX_PRIVATE CreateLogTable();
00060   void PQXX_PRIVATE CreateTransactionRecord();
00061   void PQXX_PRIVATE DeleteTransactionRecord(IDType ID) throw ();
00062   bool PQXX_PRIVATE CheckTransactionRecord(IDType ID);
00063 };
00064 
00065 
00066 
00068 
00134 template<isolation_level ISOLATIONLEVEL=read_committed>
00135 class robusttransaction : public basic_robusttransaction
00136 {
00137 public:
00138   typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00139 
00141 
00145   explicit robusttransaction(connection_base &C,
00146       const PGSTD::string &Name=PGSTD::string()) :
00147     namedclass(fullname("robusttransaction",isolation_tag::name()), Name),
00148     basic_robusttransaction(C, isolation_tag::name())
00149         { Begin(); }
00150 
00151   virtual ~robusttransaction() throw ()
00152   {
00153 #ifdef PQXX_QUIET_DESTRUCTORS
00154     internal::disable_noticer Quiet(conn());
00155 #endif
00156     End();
00157   }
00158 };
00159 
00161 
00162 } // namespace pqxx
00163 
00164 
00165 #include "pqxx/compiler-internal-post.hxx"

Generated on Sat May 27 17:33:49 2006 for libpqxx by  doxygen 1.4.6