Skip to content

Create RAII transaction objects #6

@mrts

Description

@mrts

Database changes will not be committed to the database until the active transaction is committed.

A transaction must be committed using commit(), otherwise it rolls back automatically when it destroyed.

{
    dbc::Transaction transaction = _db.createTransaction();
    try
    {
        ...
        transaction.commit();
    }
    catch (...)
    {
        ...
    }
    // automatically rolled back, unless commit() is called above
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions