transaction.hxx
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PQXX_H_TRANSACTION
00020 #define PQXX_H_TRANSACTION
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
00039
00040 class PQXX_LIBEXPORT basic_transaction : public dbtransaction
00041 {
00042 protected:
00043 basic_transaction(
00044 connection_base &C,
00045 const std::string &IsolationLevel,
00046 readwrite_policy);
00047
00048 private:
00049 virtual void do_commit() PQXX_OVERRIDE;
00050 };
00051
00052
00054
00082 template<
00083 isolation_level ISOLATIONLEVEL=read_committed,
00084 readwrite_policy READWRITE=read_write>
00085 class transaction : public basic_transaction
00086 {
00087 public:
00088 typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00089
00091
00096 explicit transaction(connection_base &C, const std::string &TName):
00097 namedclass(fullname("transaction", isolation_tag::name()), TName),
00098 basic_transaction(C, isolation_tag::name(), READWRITE)
00099 { Begin(); }
00100
00101 explicit transaction(connection_base &C) :
00102 namedclass(fullname("transaction", isolation_tag::name())),
00103 basic_transaction(C, isolation_tag::name(), READWRITE)
00104 { Begin(); }
00105
00106 virtual ~transaction() PQXX_NOEXCEPT { End(); }
00107 };
00108
00109
00111 typedef transaction<> work;
00112
00114 typedef transaction<read_committed, read_only> read_transaction;
00115
00117
00118 }
00119
00120
00121 #include "pqxx/compiler-internal-post.hxx"
00122
00123 #endif
00124