Skip to content

Create RAII transaction objects #6

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
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions