00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef PQXX_ROBUSTTRANSACTION_H
00019 #define PQXX_ROBUSTTRANSACTION_H
00020
00021
00022 #include "pqxx/dbtransaction.h"
00023
00024
00025
00026
00027
00028
00029 namespace pqxx
00030 {
00031
00032 class PQXX_LIBEXPORT basic_robusttransaction : public dbtransaction
00033 {
00034 public:
00036 typedef isolation_traits<read_committed> isolation_tag;
00037
00038 virtual ~basic_robusttransaction() =0;
00039
00040 protected:
00042
00047 explicit basic_robusttransaction(connection_base &C,
00048 const PGSTD::string &IsolationLevel,
00049 const PGSTD::string &Name);
00050
00051 private:
00052 typedef unsigned long IDType;
00053 IDType m_ID;
00054 PGSTD::string m_LogTable;
00055
00056 virtual void DoBegin();
00057 virtual result DoExec(const char[]);
00058 virtual void DoCommit();
00059 virtual void DoAbort();
00060
00061 void CreateLogTable();
00062 void CreateTransactionRecord();
00063 void DeleteTransactionRecord(IDType ID) throw ();
00064 bool CheckTransactionRecord(IDType ID);
00065 };
00066
00068 template<> inline PGSTD::string Classname(const basic_robusttransaction *)
00069 {
00070 return "basic_robusttransaction";
00071 }
00072
00073
00074
00076
00143 template<isolation_level ISOLATIONLEVEL=read_committed>
00144 class PQXX_LIBEXPORT robusttransaction : public basic_robusttransaction
00145 {
00146 public:
00147 typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00148
00149 explicit robusttransaction(connection_base &C,
00150 const PGSTD::string &TName=PGSTD::string()) :
00151 basic_robusttransaction(C, isolation_tag::name(), TName)
00152 { Begin(); }
00153
00154 virtual ~robusttransaction() { End(); }
00155 };
00156
00157
00159 template<isolation_level ISOLATIONLEVEL>
00160 inline PGSTD::string Classname(const robusttransaction<ISOLATIONLEVEL> *)
00161 {
00162 return "robusttransaction<" +
00163 isolation_traits<ISOLATIONLEVEL>::name() +
00164 ">";
00165 }
00166
00167
00169 typedef robusttransaction<read_committed> RobustTransaction;
00170
00171 }
00172
00173
00174 #endif
00175