#include <transaction_base.hxx>
Inheritance diagram for pqxx::transaction_base:
Public Types | |
typedef isolation_traits< read_committed > | isolation_tag |
If nothing else is known, our isolation level is at least read_committed. | |
Public Member Functions | |
virtual | ~transaction_base ()=0 |
void | commit () |
Commit the transaction. | |
void | abort () |
Abort the transaction. | |
result | exec (const char Query[], const PGSTD::string &Desc=PGSTD::string()) |
Execute query. | |
result | exec (const PGSTD::string &Query, const PGSTD::string &Desc=PGSTD::string()) |
Execute query. | |
result | exec (const PGSTD::stringstream &Query, const PGSTD::string &Desc=PGSTD::string()) |
connection_base & | conn () const |
Connection this transaction is running in. | |
void | set_variable (const PGSTD::string &Var, const PGSTD::string &Val) |
Set session variable in this connection. | |
PGSTD::string | get_variable (const PGSTD::string &) |
Get currently applicable value of variable. | |
Prepared statements | |
result | exec_prepared (const PGSTD::string &qname) |
Execute parameterless prepared statement. | |
result | exec_prepared (const char qname[]) |
Execute parameterless prepared statement. | |
template<typename STRING, typename ITER> | |
result | exec_prepared (STRING qname, ITER beginargs, ITER endargs) |
Execute prepared statement with given sequence of arguments. | |
template<typename CNTNR> | |
result | exec_prepared (const char qname[], const CNTNR &args) |
Execute prepared statement, taking arguments from given container. | |
template<typename CNTNR> | |
result | exec_prepared (const PGSTD::string &qname, CNTNR args) |
Execute prepared statement, taking arguments from given container. | |
Error/warning output | |
void | process_notice (const char Msg[]) const |
Have connection process warning message. | |
void | process_notice (const PGSTD::string &Msg) const |
Have connection process warning message. | |
Protected Member Functions | |
transaction_base (connection_base &, const PGSTD::string &TName, const PGSTD::string &CName) | |
Create a transaction (to be called by implementation classes only). | |
void | Begin () |
Begin transaction (to be called by implementing class). | |
void | End () throw () |
End transaction. To be called by implementing class' destructor. | |
virtual void | do_begin ()=0 |
To be implemented by derived implementation class: start transaction. | |
virtual result | do_exec (const char Query[])=0 |
To be implemented by derived implementation class: perform query. | |
virtual void | do_commit ()=0 |
To be implemented by derived implementation class: commit transaction. | |
virtual void | do_abort ()=0 |
To be implemented by derived implementation class: abort transaction. | |
result | DirectExec (const char C[], int Retries=0) |
Execute query on connection directly. | |
void | reactivation_avoidance_clear () throw () |
Forget about any reactivation-blocking resources we tried to allocate. | |
Friends | |
class | Cursor |
class | cursor_base |
class | internal::transactionfocus |
class | tablereader |
class | tablewriter |
class | pipeline |
|
If nothing else is known, our isolation level is at least read_committed.
Reimplemented in pqxx::basic_robusttransaction, pqxx::robusttransaction< ISOLATIONLEVEL >, and pqxx::transaction< ISOLATIONLEVEL >. |
|
|
|
Create a transaction (to be called by implementation classes only). The optional name, if nonempty, must begin with a letter and may contain letters and digits only. |
|
Abort the transaction. No special effort is required to call this function; it will be called implicitly when the transaction is destructed. |
|
Begin transaction (to be called by implementing class). Will typically be called from implementing class' constructor. |
|
Commit the transaction. Unless this function is called explicitly, the transaction will not be committed (actually the nontransaction implementation breaks this rule, hence the name). Once this function returns, the whole transaction will typically be irrevocably completed in the database. There is also, however, a minute risk that the connection to the database may be lost at just the wrong moment. In that case, libpqxx may be unable to determine whether the transaction was completed or aborted and an in_doubt_error will be thrown to make this fact known to the caller. The robusttransaction implementation takes some special precautions to reduce this risk. |
|
Connection this transaction is running in.
|
|
Execute query on connection directly.
|
|
To be implemented by derived implementation class: abort transaction.
|
|
To be implemented by derived implementation class: start transaction.
|
|
To be implemented by derived implementation class: commit transaction.
|
|
To be implemented by derived implementation class: perform query.
|
|
End transaction. To be called by implementing class' destructor.
|
|
|
|
Execute query. Perform a query in this transaction. This version may be slightly slower than the version taking a const char[], although the difference is not likely to be very noticeable compared to the time required to execute even a simple query.
|
|
Execute query. Perform a query in this transaction.
|
|
Execute prepared statement, taking arguments from given container. Prepared statements are defined using the connection classes' prepare() functions, and continue to live on in the ongoing session regardless of the context they were defined in (unless explicitly dropped using the connection's unprepare() function). Their execution however, like other forms of query execution, requires a transaction object.
|
|
Execute prepared statement, taking arguments from given container. Prepared statements are defined using the connection classes' prepare() functions, and continue to live on in the ongoing session regardless of the context they were defined in (unless explicitly dropped using the connection's unprepare() function). Their execution however, like other forms of query execution, requires a transaction object.
|
|
Execute prepared statement with given sequence of arguments. Prepared statements are defined using the connection classes' prepare() functions, and continue to live on in the ongoing session regardless of the context they were defined in (unless explicitly dropped using the connection's unprepare() function). Their execution however, like other forms of query execution, requires a transaction object. To include null parameters, pass a sequence of C-style string pointers. A NULL pointer will be used as a null parameter.
|
|
Execute parameterless prepared statement. Prepared statements are defined using the connection classes' prepare() functions, and continue to live on in the ongoing session regardless of the context they were defined in (unless explicitly dropped using the connection's unprepare() function). Their execution however, like other forms of query execution, requires a transaction object.
|
|
Execute parameterless prepared statement. Prepared statements are defined using the connection classes' prepare() functions, and continue to live on in the ongoing session regardless of the context they were defined in (unless explicitly dropped using the connection's unprepare() function). Their execution however, like other forms of query execution, requires a transaction object.
|
|
Get currently applicable value of variable. This function will try to consult the cache of variables set (both in the transaction and in the connection) using the set_variable functions. If it is not found there, the database is queried.
|
|
Have connection process warning message.
|
|
Have connection process warning message.
|
|
Forget about any reactivation-blocking resources we tried to allocate.
|
|
Set session variable in this connection. The new value is typically forgotten if the transaction aborts. Known exceptions to this rule are nontransaction, and PostgreSQL versions prior to 7.3. In the case of nontransaction, the set value will be kept regardless; but in that case, if the connection ever needs to be recovered, the set value will not be restored.
|
|
|
|
|
|
|
|
|
|
|
|
|