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

robusttransaction.hxx

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  *   FILE
00004  *      pqxx/robusttransaction.hxx
00005  *
00006  *   DESCRIPTION
00007  *      definition of the pqxx::robusttransaction class.
00008  *   pqxx::robusttransaction is a slower but safer transaction class
00009  *   DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/robusttransaction instead.
00010  *
00011  * Copyright (c) 2002-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 #include "pqxx/dbtransaction"
00022 
00023 
00024 /* Methods tested in eg. self-test program test001 are marked with "//[t1]"
00025  */
00026 
00027 
00028 namespace pqxx
00029 {
00030 
00035 
00036 class PQXX_LIBEXPORT basic_robusttransaction : public dbtransaction
00037 {
00038 public:
00040   typedef isolation_traits<read_committed> isolation_tag;
00041 
00042   virtual ~basic_robusttransaction() =0;                                //[t16]
00043 
00044 protected:
00046 
00051   explicit basic_robusttransaction(connection_base &C,
00052                                    const PGSTD::string &IsolationLevel,
00053                                    const PGSTD::string &Name);          //[t16]
00054 
00055 private:
00056   typedef unsigned long IDType;
00057   IDType m_ID;
00058   PGSTD::string m_LogTable;
00059   int m_backendpid;
00060 
00061   virtual void do_begin();                                              //[t18]
00062   virtual void do_commit();                                             //[t16]
00063   virtual void do_abort();                                              //[t18]
00064 
00065   void PQXX_PRIVATE CreateLogTable();
00066   void PQXX_PRIVATE CreateTransactionRecord();
00067   void PQXX_PRIVATE DeleteTransactionRecord(IDType ID) throw ();
00068   bool PQXX_PRIVATE CheckTransactionRecord(IDType ID);
00069 };
00070 
00071 
00072 
00074 
00140 template<isolation_level ISOLATIONLEVEL=read_committed>
00141 class robusttransaction : public basic_robusttransaction
00142 {
00143 public:
00144   typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00145 
00146   explicit robusttransaction(connection_base &C, const PGSTD::string &TName) :
00147     basic_robusttransaction(C, isolation_tag::name(), TName)
00148         { Begin(); }
00149 
00150   explicit robusttransaction(connection_base &C) :
00151     basic_robusttransaction(C, isolation_tag::name(), PGSTD::string())
00152         { Begin(); }
00153 
00154   virtual ~robusttransaction() throw ()
00155   {
00156 #ifdef PQXX_QUIET_DESTRUCTORS
00157     internal::disable_noticer Quiet(conn());
00158 #endif
00159     End();
00160   }
00161 };
00162 
00164 
00165 } // namespace pqxx
00166 
00167 

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