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

A simple transaction guard implementing RAAI for savepoints. Savepoints can be used recursively. More...

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

Public Member Functions

 savepoint (connection &conn, std::string name)
 Create transaction guard and initiate it.
 
 savepoint (connection &conn, std::string name, transaction::adopt_transaction_t)
 Create savepoint guard on an existing savepoint.
 
 ~savepoint () noexcept(false)
 rollback to the savepoint if not committed.
 
const std::string & name () const
 The name of the savepoint.
 
void commit ()
 
void commit (system::error_code &ec, error_info &ei)
 
void release ()
 
void release (system::error_code &ec, error_info &ei)
 
void rollback ()
 
void rollback (system::error_code &ec, error_info &ei)
 

Static Public Attributes

static constexpr transaction::adopt_transaction_t adopt_transaction {}
 A tag to use, to adopt an already initiated transaction.
 

Detailed Description

A simple transaction guard implementing RAAI for savepoints. Savepoints can be used recursively.

Example
conn.connect("./my-database.db");
sqlite::savepoint t{conn, "my-savepoint};
conn.prepare("insert into log (text) values ($1)").execute(std::make_tuple("booting up"));
t.commit();
@ text
A textual value.
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 savepoints. Savepoints can be used recursively.

Definition at line 117 of file transaction.hpp.

Member Function Documentation

◆ commit() [1/2]

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

Commit/Release the transaction.

Definition at line 145 of file transaction.hpp.

◆ commit() [2/2]

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

Commit/Release the transaction.

Definition at line 151 of file transaction.hpp.

◆ release() [1/2]

void boost::sqlite::savepoint::release ( )
inline

Commit/Release the transaction.

Definition at line 157 of file transaction.hpp.

◆ release() [2/2]

void boost::sqlite::savepoint::release ( system::error_code & ec,
error_info & ei )
inline

Commit/Release the transaction.

Definition at line 163 of file transaction.hpp.

◆ rollback() [1/2]

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

Rollback the transaction explicitly.

Definition at line 172 of file transaction.hpp.

◆ rollback() [2/2]

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

Rollback the transaction explicitly.

Definition at line 178 of file transaction.hpp.


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