An utility class to coordinate transactions. More...
#include <ScopedTransaction.h>
Public Member Functions | |
void | commit () |
It commits the transaction. More... | |
ScopedTransaction (te::da::DataSourceTransactor &transactor) | |
Constructor. More... | |
~ScopedTransaction () | |
Destructor. More... | |
Private Attributes | |
bool | m_rollback |
A flag that indicates if the transaction may be aborted at the end. More... | |
te::da::DataSourceTransactor & | m_t |
A reference to the underlying transactor. More... | |
An utility class to coordinate transactions.
This class can be used to create an object that automatically rollback a transaction when it goes out of scope.
When the client has finished performing operations it must explicitly call the commit method. This will inform ScopedTransaction to not rollback when it goes out of scope.
Definition at line 56 of file ScopedTransaction.h.
te::da::ScopedTransaction::ScopedTransaction | ( | te::da::DataSourceTransactor & | transactor | ) |
Constructor.
transactor | The transactor that will be used to initiate a transaction. |
te::da::ScopedTransaction::~ScopedTransaction | ( | ) |
Destructor.
void te::da::ScopedTransaction::commit | ( | ) |
It commits the transaction.
It | throws an exception if something goes wrong during transaction commitment. |
|
private |
A flag that indicates if the transaction may be aborted at the end.
Definition at line 80 of file ScopedTransaction.h.
|
private |
A reference to the underlying transactor.
Definition at line 79 of file ScopedTransaction.h.