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
00035
00036 class PQXX_LIBEXPORT basic_robusttransaction : public dbtransaction
00037 {
00038 public:
00040 typedef isolation_traits<read_committed> isolation_tag;
00041
00042 virtual ~basic_robusttransaction() =0;
00043
00044 protected:
00046
00051 explicit basic_robusttransaction(connection_base &C,
00052 const PGSTD::string &IsolationLevel,
00053 const PGSTD::string &Name);
00054
00055 private:
00056 typedef unsigned long IDType;
00057 IDType m_ID;
00058 PGSTD::string m_LogTable;
00059 int m_backendpid;
00060
00061 virtual void do_begin();
00062 virtual void do_commit();
00063 virtual void do_abort();
00064
00065 void PQXX_PRIVATE CreateLogTable();
00066 void PQXX_PRIVATE CreateTransactionRecord();
00067 void PQXX_PRIVATE DeleteTransactionRecord(IDType ID) throw ();
00068 bool PQXX_PRIVATE CheckTransactionRecord(IDType ID);
00069 };
00070
00071
00072
00074
00140 template<isolation_level ISOLATIONLEVEL=read_committed>
00141 class robusttransaction : public basic_robusttransaction
00142 {
00143 public:
00144 typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00145
00146 explicit robusttransaction(connection_base &C, const PGSTD::string &TName) :
00147 basic_robusttransaction(C, isolation_tag::name(), TName)
00148 { Begin(); }
00149
00150 explicit robusttransaction(connection_base &C) :
00151 basic_robusttransaction(C, isolation_tag::name(), PGSTD::string())
00152 { Begin(); }
00153
00154 virtual ~robusttransaction() throw ()
00155 {
00156 #ifdef PQXX_QUIET_DESTRUCTORS
00157 internal::disable_noticer Quiet(conn());
00158 #endif
00159 End();
00160 }
00161 };
00162
00164
00165 }
00166
00167