CONZEPT 16 C++ API
|
Transaction of a database. More...
#include "C16/Transaction.hpp"
Transaction of a database.
Public Types | |
enum | State { State::ACTIVE = 1, State::COMMITTED, State::ABORTED } |
State of a transaction. More... | |
Public Member Functions | |
Transaction (Database &database) | |
Constructs and starts a transaction. More... | |
~Transaction () | |
Aborts and destructs the transaction. More... | |
State | state () const |
Gets the state of the transaction. More... | |
bool | active () const |
Gets if the transaction is active. More... | |
bool | comitted () const |
Gets if the transaction was comitted. More... | |
bool | aborted () const |
Gets if the transaction was aborted. More... | |
int | level () const |
Gets the level of the transaction. More... | |
void | commit () |
Commits the transaction if it is active. More... | |
void | abort () |
Aborts the transaction if it is active. More... | |
|
strong |
State of a transaction.
Enumerator | |
---|---|
ACTIVE | Transaction is active. |
COMMITTED | Transaction was commited. |
ABORTED | Transaction was aborted. |
|
explicit |
C16::Transaction::~Transaction | ( | ) |
Aborts and destructs the transaction.
bool C16::Transaction::active | ( | ) | const |
Gets if the transaction is active.
bool C16::Transaction::comitted | ( | ) | const |
Gets if the transaction was comitted.
bool C16::Transaction::aborted | ( | ) | const |
Gets if the transaction was aborted.
int C16::Transaction::level | ( | ) | const |
Gets the level of the transaction.
The level is the number of active transactions when the transaction was started (including this transaction).
void C16::Transaction::commit | ( | ) |
Commits the transaction if it is active.
If the transaction is the only active one (i.e. the level of the transaction is one), all manipulations to database entities that are covered by transactions will be applied.
The state of the transaction and all active transactions that were started after this transaction (i.e. the level of the transactions is greater than the level of this transaction) will be "committed".
void C16::Transaction::abort | ( | ) |
Aborts the transaction if it is active.
If the transaction is the only active one (i.e. the level of the transaction is one), all manipulations to database entities that are covered by transactions will be rejected.
The state of the transaction and all active transactions that were started after this transaction (i.e. the level of the transactions is greater than the level of this transaction) will be "aborted".