robusttransaction.hxx
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PQXX_H_ROBUSTTRANSACTION
00020 #define PQXX_H_ROBUSTTRANSACTION
00021
00022 #include "pqxx/compiler-public.hxx"
00023 #include "pqxx/compiler-internal-pre.hxx"
00024
00025 #include "pqxx/dbtransaction"
00026
00027
00028
00029
00030
00031
00032 namespace pqxx
00033 {
00034
00041 class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction :
00042 public dbtransaction
00043 {
00044 public:
00046 typedef isolation_traits<read_committed> isolation_tag;
00047
00048 virtual ~basic_robusttransaction() =0;
00049
00050 protected:
00051 basic_robusttransaction(
00052 connection_base &C,
00053 const std::string &IsolationLevel,
00054 const std::string &table_name=std::string());
00055
00056 private:
00057 typedef unsigned long IDType;
00058 IDType m_record_id;
00059 std::string m_xid;
00060 std::string m_LogTable;
00061 std::string m_sequence;
00062 int m_backendpid;
00063
00064 virtual void do_begin() PQXX_OVERRIDE;
00065 virtual void do_commit() PQXX_OVERRIDE;
00066 virtual void do_abort() PQXX_OVERRIDE;
00067
00068 PQXX_PRIVATE void CreateLogTable();
00069 PQXX_PRIVATE void CreateTransactionRecord();
00070 PQXX_PRIVATE std::string sql_delete() const;
00071 PQXX_PRIVATE void DeleteTransactionRecord() PQXX_NOEXCEPT;
00072 PQXX_PRIVATE bool CheckTransactionRecord();
00073 };
00074
00075
00076
00078
00144 template<isolation_level ISOLATIONLEVEL=read_committed>
00145 class robusttransaction : public basic_robusttransaction
00146 {
00147 public:
00148 typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00149
00151
00155 explicit robusttransaction(connection_base &C,
00156 const std::string &Name=std::string()) :
00157 namedclass(fullname("robusttransaction",isolation_tag::name()), Name),
00158 basic_robusttransaction(C, isolation_tag::name())
00159 { Begin(); }
00160
00161 virtual ~robusttransaction() PQXX_NOEXCEPT { End(); }
00162 };
00163
00168 }
00169
00170
00171 #include "pqxx/compiler-internal-post.hxx"
00172
00173 #endif
00174