Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

transactor.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  *   FILE
00004  *      pqxx/transactor.h
00005  *
00006  *   DESCRIPTION
00007  *      definition of the pqxx::Transactor class.
00008  *   pqxx::Transactor is a framework-style wrapper for safe transactions
00009  *
00010  * Copyright (c) 2001-2003, Jeroen T. Vermeulen <jtv@xs4all.nl>
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef PQXX_TRANSACTOR_H
00015 #define PQXX_TRANSACTOR_H
00016 
00017 #include <string>
00018 
00019 #include "pqxx/compiler.h"
00020 
00021 
00022 /* Methods tested in eg. self-test program test1 are marked with "//[t1]"
00023  */
00024 
00025 
00026 namespace pqxx
00027 {
00028 class Transaction;
00029 
00031 
00056 class PQXX_LIBEXPORT Transactor
00057 {
00058 public:
00059   explicit Transactor(const PGSTD::string &TName="AnonymousTransactor") ://[t4]
00060     m_Name(TName) {}
00061 
00063 
00066   typedef Transaction argument_type;
00067 
00069   typedef void result_type;
00070 
00072 
00078   void operator()(argument_type &T);                                    //[t4]
00079 
00080   // Overridable member functions, called by Connection::Perform() if attempt 
00081   // to run transaction fails/succeeds, respectively, or if the connection is
00082   // lost at just the wrong moment, goes into an indeterminate state.  Use 
00083   // these to patch up runtime state to match events, if needed, or to report 
00084   // failure conditions.
00085 
00087 
00093   void OnAbort(const char /*Reason*/[]) throw () {}                     //[t13]
00094 
00096 
00099   void OnCommit() {}                                                    //[t6]
00100 
00103 
00112   void OnDoubt() throw () {}                                            //[t13]
00113 
00115   PGSTD::string Name() const { return m_Name; }                         //[t13]
00116 
00117 private:
00118   PGSTD::string m_Name;
00119 };
00120 
00121 }
00122 
00123 #endif
00124 

Generated on Fri Feb 28 19:23:32 2003 for libpqxx by doxygen1.3-rc3