Main Page | 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 
00031 class PQXX_LIBEXPORT basic_robusttransaction : public dbtransaction
00032 {
00033 public:
00035   typedef isolation_traits<read_committed> isolation_tag;
00036 
00037   virtual ~basic_robusttransaction() =0;                                //[t16]
00038 
00039 protected:
00041 
00046   explicit basic_robusttransaction(connection_base &C,
00047                                    const PGSTD::string &IsolationLevel,
00048                                    const PGSTD::string &Name);          //[t16]
00049 
00050 private:
00051   typedef unsigned long IDType;
00052   IDType m_ID;
00053   PGSTD::string m_LogTable;
00054   int m_backendpid;
00055 
00056   virtual void do_begin();                                              //[t18]
00057   virtual void do_commit();                                             //[t16]
00058   virtual void do_abort();                                              //[t18]
00059 
00060   void CreateLogTable();
00061   void CreateTransactionRecord();
00062   void DeleteTransactionRecord(IDType ID) throw ();
00063   bool CheckTransactionRecord(IDType ID);
00064 };
00065 
00066 
00067 
00069 
00135 template<isolation_level ISOLATIONLEVEL=read_committed>
00136 class robusttransaction : public basic_robusttransaction
00137 {
00138 public:
00139   typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00140 
00141   explicit robusttransaction(connection_base &C, const PGSTD::string &TName) :
00142     basic_robusttransaction(C, isolation_tag::name(), TName)
00143         { Begin(); }
00144 
00145   explicit robusttransaction(connection_base &C) :
00146     basic_robusttransaction(C, isolation_tag::name(), PGSTD::string())
00147         { Begin(); }
00148 
00149   virtual ~robusttransaction() throw ()
00150   {
00151 #ifdef PQXX_QUIET_DESTRUCTORS
00152     internal::disable_noticer Quiet(conn());
00153 #endif
00154     End();
00155   }
00156 };
00157 
00158 } // namespace pqxx
00159 
00160 

Generated on Mon Feb 28 10:24:56 2005 for libpqxx by  doxygen 1.4.1