HDK
|
#include <UT_SQL.h>
Public Types | |
using | commit_callback_t = UT_Function< bool()> |
Public Member Functions | |
UT_AutoSqlTransaction (UT_SqlDatabase &conn, commit_callback_t &&commit_callback, bool savepoint=true, bool durable=false) | |
~UT_AutoSqlTransaction () | |
UT_NON_COPYABLE (UT_AutoSqlTransaction) | |
operator bool () const | |
void | commit () |
void | rollback () |
void | fail () |
const UT_ErrorCode & | entryFailure () |
Helper object to optionally create/commit/rollback savepoints and transactions. The user passes a commit callback function which informs the object if the transaction was a success or failure. This callback is called only once on this objects dtor. If it returns true it means the transaction was a success and the transaction/savepoint should be committed. There are helper functions on the object to early commit or rollback when necessary. Generally speaking the user should leave that logic to the dtor and the commit callback.
using UT_AutoSqlTransaction::commit_callback_t = UT_Function<bool()> |
UT_AutoSqlTransaction::UT_AutoSqlTransaction | ( | UT_SqlDatabase & | conn, |
commit_callback_t && | commit_callback, | ||
bool | savepoint = true , |
||
bool | durable = false |
||
) |
UT_AutoSqlTransaction::~UT_AutoSqlTransaction | ( | ) |
void UT_AutoSqlTransaction::commit | ( | ) |
Used to early commit the transaction. Generally this should not be used as the transaction exit scope should be used to commit/rollback transactions.
|
inline |
|
inline |
|
inlineexplicit |
void UT_AutoSqlTransaction::rollback | ( | ) |
Used to early rollback the transaction. Generally this should not be used as the transaction exit scope should be used to commit/rollback transactions.
UT_AutoSqlTransaction::UT_NON_COPYABLE | ( | UT_AutoSqlTransaction | ) |