A helper object for database transactions.
More...
#include <cbl++/Database.hh>
|
| | Transaction (Database db) |
| | Begins a batch operation on the database that will end when the Batch instance goes out of scope.
|
| | Transaction (CBLDatabase *db) |
| | Begins a batch operation on the given C database handle.
|
| void | commit () |
| | Commits changes and ends the transaction.
|
| void | abort () |
| | Ends the transaction, rolling back changes.
|
| | ~Transaction () |
| | Ends the transaction, rolling back any changes that have not been committed.
|
A helper object for database transactions.
A Transaction object should be declared as a local (auto) variable. You must explicitly call commit to commit changes; if you don't, the transaction will abort when it goes out of scope.
◆ Transaction() [1/2]
| cbl::Transaction::Transaction |
( |
Database | db | ) |
|
|
inlineexplicit |
Begins a batch operation on the database that will end when the Batch instance goes out of scope.
◆ Transaction() [2/2]
Begins a batch operation on the given C database handle.
Provided for callers that hold a raw CBLDatabase pointer rather than a C++ Database wrapper.
- Parameters
-
| db | The database to begin a transaction on. |
◆ ~Transaction()
| cbl::Transaction::~Transaction |
( |
| ) |
|
|
inline |
Ends the transaction, rolling back any changes that have not been committed.
◆ abort()
| void cbl::Transaction::abort |
( |
| ) |
|
|
inline |
Ends the transaction, rolling back changes.
◆ commit()
| void cbl::Transaction::commit |
( |
| ) |
|
|
inline |
Commits changes and ends the transaction.
The documentation for this class was generated from the following file: