VSQLite++ 0.3
Loading...
Searching...
No Matches
sqlite::v2::transaction Struct Reference

transaction is a helper class to start transactions within SQLite More...

#include <transaction.hpp>

Collaboration diagram for sqlite::v2::transaction:
Collaboration graph

Public Member Functions

 transaction (connection &con, transaction_type type=transaction_type::undefined)
 constructor
 ~transaction ()
 destructor
void begin (transaction_type type=transaction_type::undefined)
 Starts a transaction.
void end ()
 Ends an transaction.
void commit ()
 Commits a transaction.
void rollback ()
 Rolls back a transaction.
bool isActive () const
 Allow to check if transaction handled by this object is currently active.
bool isEnding () const
snapshot take_snapshot (std::string_view schema="main")
 Capture a consistent snapshot for the current transaction.
void open_snapshot (snapshot const &snap, std::string_view schema="main")
 Re-open this transaction so it reads from the supplied snapshot.

Private Member Functions

void exec (std::string const &)

Private Attributes

connectionm_con
bool m_isActive {false}
 if true there is a transaction currently opened
bool m_isEnding {false}
 true while COMMIT/ROLLBACK/END is running

Detailed Description

transaction is a helper class to start transactions within SQLite

Definition at line 69 of file transaction.hpp.

Constructor & Destructor Documentation

◆ transaction()

sqlite::v2::transaction::transaction ( connection & con,
transaction_type type = transaction_type::undefined )

constructor

Parameters
cona reference to the connection object where the transaction should be started/ended/committed or rolled back
typedefine the transaction type

References sqlite::v2::undefined.

◆ ~transaction()

sqlite::v2::transaction::~transaction ( )

destructor

Member Function Documentation

◆ begin()

void sqlite::v2::transaction::begin ( transaction_type type = transaction_type::undefined)

Starts a transaction.

Parameters
typedefine the transaction type

References sqlite::v2::undefined.

◆ commit()

void sqlite::v2::transaction::commit ( )

Commits a transaction.

◆ end()

void sqlite::v2::transaction::end ( )

Ends an transaction.

◆ exec()

void sqlite::v2::transaction::exec ( std::string const & )
private

◆ isActive()

bool sqlite::v2::transaction::isActive ( ) const
inline

Allow to check if transaction handled by this object is currently active.

Returns
true if transaction is still active, false otherwise

Definition at line 107 of file transaction.hpp.

References m_isActive.

◆ isEnding()

bool sqlite::v2::transaction::isEnding ( ) const
inline

Definition at line 109 of file transaction.hpp.

References m_isEnding.

◆ open_snapshot()

void sqlite::v2::transaction::open_snapshot ( snapshot const & snap,
std::string_view schema = "main" )

Re-open this transaction so it reads from the supplied snapshot.

◆ rollback()

void sqlite::v2::transaction::rollback ( )

Rolls back a transaction.

◆ take_snapshot()

snapshot sqlite::v2::transaction::take_snapshot ( std::string_view schema = "main")

Capture a consistent snapshot for the current transaction.

Parameters
schemaDatabase schema name (defaults to "main").

Member Data Documentation

◆ m_con

connection& sqlite::v2::transaction::m_con
private

Definition at line 121 of file transaction.hpp.

◆ m_isActive

bool sqlite::v2::transaction::m_isActive {false}
private

if true there is a transaction currently opened

Definition at line 122 of file transaction.hpp.

Referenced by isActive().

◆ m_isEnding

bool sqlite::v2::transaction::m_isEnding {false}
private

true while COMMIT/ROLLBACK/END is running

Definition at line 123 of file transaction.hpp.

Referenced by isEnding().


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