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-2004, 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/dbtransaction"
00020 
00021 
00022 /* Methods tested in eg. self-test program test001 are marked with "//[t1]"
00023  */
00024 
00025 
00026 namespace pqxx
00027 {
00028 
00029 class PQXX_LIBEXPORT basic_robusttransaction : public dbtransaction
00030 {
00031 public:
00033   typedef isolation_traits<read_committed> isolation_tag;
00034 
00035   virtual ~basic_robusttransaction() =0;                                //[t16]
00036 
00037 protected:
00039 
00044   explicit basic_robusttransaction(connection_base &C,
00045                                    const PGSTD::string &IsolationLevel,
00046                                    const PGSTD::string &Name);          //[t16]
00047 
00048 private:
00049   typedef unsigned long IDType;
00050   IDType m_ID;
00051   PGSTD::string m_LogTable;
00052   int m_backendpid;
00053 
00054   virtual void do_begin();                                              //[t18]
00055   virtual void do_commit();                                             //[t16]
00056   virtual void do_abort();                                              //[t18]
00057 
00058   void CreateLogTable();
00059   void CreateTransactionRecord();
00060   void DeleteTransactionRecord(IDType ID) throw ();
00061   bool CheckTransactionRecord(IDType ID);
00062 };
00063 
00064 
00065 
00067 
00133 template<isolation_level ISOLATIONLEVEL=read_committed>
00134 class robusttransaction : public basic_robusttransaction
00135 {
00136 public:
00137   typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
00138 
00139   explicit robusttransaction(connection_base &C, const PGSTD::string &TName) :
00140     basic_robusttransaction(C, isolation_tag::name(), TName)
00141         { Begin(); }
00142 
00143   explicit robusttransaction(connection_base &C) :
00144     basic_robusttransaction(C, isolation_tag::name(), PGSTD::string())
00145         { Begin(); }
00146 
00147   virtual ~robusttransaction() throw () { End(); }
00148 };
00149 
00150 } // namespace pqxx
00151 
00152 

Generated on Mon Nov 15 11:28:00 2004 for libpqxx by  doxygen 1.3.9.1