Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

transaction.hxx

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  *   FILE
00004  *      pqxx/transaction.hxx
00005  *
00006  *   DESCRIPTION
00007  *      definition of the pqxx::transaction class.
00008  *   pqxx::transaction represents a standard database transaction
00009  *   DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transaction instead.
00010  *
00011  * Copyright (c) 2001-2005, Jeroen T. Vermeulen <jtv@xs4all.nl>
00012  *
00013  * See COPYING for copyright license.  If you did not receive a file called
00014  * COPYING with this source code, please notify the distributor of this mistake,
00015  * or contact the author.
00016  *
00017  *-------------------------------------------------------------------------
00018  */
00019 #include "pqxx/libcompiler.h"
00020 
00021 
00022 #include "pqxx/dbtransaction"
00023 
00024 
00025 
00026 /* Methods tested in eg. self-test program test1 are marked with "//[t1]"
00027  */
00028 
00029 
00030 namespace pqxx
00031 {
00032 
00037 
00038 class PQXX_LIBEXPORT basic_transaction : public dbtransaction
00039 {
00040 protected:
00041   explicit basic_transaction(connection_base &C,
00042                              const PGSTD::string &IsolationLevel,
00043                              const PGSTD::string &TName);               //[t1]
00044 
00045 private:
00046   virtual void do_begin();                                              //[t1]
00047   virtual void do_commit();                                             //[t1]
00048   virtual void do_abort();                                              //[t13]
00049 };
00050 
00051 
00053 
00081 template<isolation_level ISOLATIONLEVEL=read_committed>
00082 class transaction : public basic_transaction
00083 {
00084 public:
00085   typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00086 
00088 
00093   explicit transaction(connection_base &C, const PGSTD::string &TName): //[t1]
00094     basic_transaction(C, isolation_tag::name(), TName)
00095         { Begin(); }
00096 
00097   explicit transaction(connection_base &C) :                            //[t1]
00098     basic_transaction(C, isolation_tag::name(), PGSTD::string())
00099         { Begin(); }
00100 
00101   virtual ~transaction() throw ()
00102   {
00103 #ifdef PQXX_QUIET_DESTRUCTORS
00104     internal::disable_noticer Quiet(conn());
00105 #endif
00106     End();
00107   }
00108 
00109 protected:
00110   virtual const char *classname() const throw () { return "transaction"; }
00111 };
00112 
00113 
00115 typedef transaction<> work;
00116 
00118 
00119 }
00120 
00121 

Generated on Mon Oct 3 20:28:59 2005 for libpqxx by  doxygen 1.4.2