tntdb
1.1
|
The class Transaction monitors the state of a transaction on a database-conection. More...
#include <transaction.h>
Public Member Functions | |
Transaction (const Connection &db_, bool starttransaction=true) | |
Start a transaction when instructed. | |
~Transaction () | |
roll back transaction when still active | |
const Connection & | getConnection () const |
void | begin () |
Starts a new transaction. | |
void | commit () |
commits the current transaction. | |
void | rollback () |
rolls back the current transaction. |
The class Transaction monitors the state of a transaction on a database-conection.
The constructor starts by default a transaction on the database. The transactionstate is hold it the class. The destructor rolls the transaction back, when not explicitely commited or rolled back.
tntdb::Transaction::Transaction | ( | const Connection & | db_, |
bool | starttransaction = true |
||
) | [inline] |
Start a transaction when instructed.
tntdb::Transaction::~Transaction | ( | ) | [inline] |
roll back transaction when still active
void tntdb::Transaction::begin | ( | ) | [inline] |
Starts a new transaction.
If there is a active transaction, it is rolled back first
void tntdb::Transaction::commit | ( | ) | [inline] |
commits the current transaction.
If there is no active transaction, then nothing is done. The transactionstate is reset.
void tntdb::Transaction::rollback | ( | ) | [inline] |
rolls back the current transaction.
If there is no active transaction, then nothing is done. The transactionstate is reset.