libpqxx
pqxx::transactor< TRANSACTION > Class Template Reference

#include <transactor.hxx>

Public Types

using argument_type = TRANSACTION
 

Public Member Functions

 transactor (const std::string &TName="transactor")
 
void operator() (TRANSACTION &T)
 Overridable transaction definition; insert your database code here. More...
 
void on_abort (const char[]) noexcept
 Optional overridable function to be called if transaction is aborted. More...
 
void on_commit ()
 Optional overridable function to be called after successful commit. More...
 
void on_doubt () noexcept
 Overridable function to be called when "in doubt" about outcome. More...
 
std::string name () const
 The transactor's name. More...
 

Detailed Description

template<typename TRANSACTION = transaction<read_committed>>
class pqxx::transactor< TRANSACTION >

Deprecated:
Pre-C++11 wrapper for automatically retrying transactions.

Pass an object of your transactor-based class to connection_base::perform() to execute the transaction code embedded in it.

connection_base::perform() is actually a template, specializing itself to any transactor type you pass to it. This means you will have to pass it a reference of your object's ultimate static type; runtime polymorphism is not allowed. Hence the absence of virtual methods in transactor. The exact methods to be called at runtime must be resolved at compile time.

Your transactor-derived class must define a copy constructor. This will be used to create a "clean" copy of your transactor for every attempt that perform() makes to run it.


The documentation for this class was generated from the following file: