00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #include "pqxx/libcompiler.h"
00020 
00021 #include "pqxx/dbtransaction"
00022 
00023 
00024 
00025 
00026 
00027 
00028 namespace pqxx
00029 {
00030 
00031 class PQXX_LIBEXPORT basic_robusttransaction : public dbtransaction
00032 {
00033 public:
00035   typedef isolation_traits<read_committed> isolation_tag;
00036 
00037   virtual ~basic_robusttransaction() =0;                                
00038 
00039 protected:
00041 
00046   explicit basic_robusttransaction(connection_base &C,
00047                                    const PGSTD::string &IsolationLevel,
00048                                    const PGSTD::string &Name);          
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();                                              
00057   virtual void do_commit();                                             
00058   virtual void do_abort();                                              
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 
00141   explicit robusttransaction(connection_base &C, const PGSTD::string &TName) :
00142     basic_robusttransaction(C, isolation_tag::name(), TName)
00143         { Begin(); }
00144 
00145   explicit robusttransaction(connection_base &C) :
00146     basic_robusttransaction(C, isolation_tag::name(), PGSTD::string())
00147         { Begin(); }
00148 
00149   virtual ~robusttransaction() throw ()
00150   {
00151 #ifdef PQXX_QUIET_DESTRUCTORS
00152     internal::disable_noticer Quiet(conn());
00153 #endif
00154     End();
00155   }
00156 };
00157 
00158 } 
00159 
00160