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
00033 namespace pqxx
00034 {
00035
00040
00041 class PQXX_LIBEXPORT basic_transaction : public dbtransaction
00042 {
00043 protected:
00044 basic_transaction(
00045 connection_base &C,
00046 const PGSTD::string &IsolationLevel,
00047 readwrite_policy);
00048
00049 private:
00050 virtual void do_commit();
00051 };
00052
00053
00055
00083 template<
00084 isolation_level ISOLATIONLEVEL=read_committed,
00085 readwrite_policy READWRITE=read_write>
00086 class transaction : public basic_transaction
00087 {
00088 public:
00089 typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00090
00092
00097 explicit transaction(connection_base &C, const PGSTD::string &TName):
00098 namedclass(fullname("transaction", isolation_tag::name()), TName),
00099 basic_transaction(C, isolation_tag::name(), READWRITE)
00100 { Begin(); }
00101
00102 explicit transaction(connection_base &C) :
00103 namedclass(fullname("transaction", isolation_tag::name())),
00104 basic_transaction(C, isolation_tag::name(), READWRITE)
00105 { Begin(); }
00106
00107 virtual ~transaction() throw ()
00108 {
00109 #ifdef PQXX_QUIET_DESTRUCTORS
00110 disable_noticer Quiet(conn());
00111 #endif
00112 End();
00113 }
00114 };
00115
00116
00118 typedef transaction<> work;
00119
00121 typedef transaction<read_committed, read_only> read_transaction;
00122
00124
00125 }
00126
00127
00128 #include "pqxx/compiler-internal-post.hxx"
00129
00130 #endif
00131