19 #ifndef PQXX_H_TRANSACTOR 20 #define PQXX_H_TRANSACTOR 22 #include "pqxx/compiler-public.hxx" 23 #include "pqxx/compiler-internal-pre.hxx" 25 #include "pqxx/connection_base" 26 #include "pqxx/transaction" 65 template<
typename TRANSACTION=transaction<read_committed> >
67 public PGSTD::unary_function<TRANSACTION, void>
70 explicit transactor(
const PGSTD::string &TName=
"transactor") :
127 PGSTD::string
Name()
const {
return m_Name; }
130 PGSTD::string m_Name;
137 template<
typename TRANSACTOR>
141 if (Attempts <= 0)
return;
155 typename TRANSACTOR::argument_type X(*
this, T2.Name());
167 catch (
const PGSTD::exception &e)
170 T2.on_abort(e.what());
171 if (Attempts <= 0)
throw;
177 T2.on_abort(
"Unknown exception");
186 #include "pqxx/compiler-internal-post.hxx" void on_doubt()
Overridable function to be called when "in doubt" about outcome.
Definition: transactor.hxx:123
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:156
transactor(const std::string &TName="transactor")
Definition: transactor.hxx:70
std::string Name() const
The transactor's name.
Definition: transactor.hxx:127
void perform(const TRANSACTOR &T, int Attempts)
Perform the transaction defined by a transactor-based object.
Definition: transactor.hxx:138
void on_commit()
Optional overridable function to be called after successful commit.
Definition: transactor.hxx:109
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
void on_abort(const char[])
Optional overridable function to be called if transaction is aborted.
Definition: transactor.hxx:102
void operator()(TRANSACTION &T)
Overridable transaction definition; insert your database code here.
Definition: transactor.hxx:66