boost_sqlite 1
A sqlite C++ library
Loading...
Searching...
No Matches
boost::sqlite::transaction Struct Reference

A simple transaction guard implementing RAAI for transactions. More...

#include <include/boost/sqlite/transaction.hpp>

Public Types

enum  behaviour
 The mode of the transaction.
 

Public Member Functions

 transaction (connection &conn)
 Create transaction guard and initiate a transaction.
 
 transaction (connection &conn, adopt_transaction_t)
 Create transaction guard on an existing transaction.
 
 transaction (connection &conn, behaviour b)
 Create transaction guard and initiate a transaction with the defined behaviour.
 
 ~transaction () noexcept(false)
 rollback the transaction if not committed.
 
void commit ()
 
void commit (system::error_code &ec, error_info &ei)
 
void rollback ()
 
void rollback (system::error_code &ec, error_info &ei)
 

Detailed Description

A simple transaction guard implementing RAAI for transactions.

Example
conn.connect("./my-database.db");
conn.prepare("insert into log (text) values ($1)").execute(std::make_tuple("booting up"));
t.commit();
main object for a connection to a database.
void connect(cstring_ref filename, int flags=SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE)
A simple transaction guard implementing RAAI for transactions.

Definition at line 29 of file transaction.hpp.

Member Function Documentation

◆ commit() [1/2]

void boost::sqlite::transaction::commit ( )
inline

Commit the transaction.

Definition at line 71 of file transaction.hpp.

◆ commit() [2/2]

void boost::sqlite::transaction::commit ( system::error_code & ec,
error_info & ei )
inline

Commit the transaction.

Definition at line 77 of file transaction.hpp.

◆ rollback() [1/2]

void boost::sqlite::transaction::rollback ( )
inline

Rollback the transaction explicitly.

Definition at line 86 of file transaction.hpp.

◆ rollback() [2/2]

void boost::sqlite::transaction::rollback ( system::error_code & ec,
error_info & ei )
inline

Rollback the transaction explicitly.

Definition at line 92 of file transaction.hpp.


The documentation for this struct was generated from the following file: