SQLiteC++  0.5.0
SQLiteC++ is a smart and easy to use C++ SQLite3 wrapper.
 All Classes Namespaces Files Functions Friends Macros
SQLite::Transaction Class Reference

RAII encapsulation of a SQLite Transaction. More...

#include <Transaction.h>

Public Member Functions

 Transaction (Database &aDatabase)
 Begins the SQLite transaction. More...
 
virtual ~Transaction (void) throw ()
 Safely rollback the transaction if it has not been committed. More...
 
void commit (void)
 Commit the transaction. More...
 

Detailed Description

RAII encapsulation of a SQLite Transaction.

A Transaction is a way to group multiple SQL statements into an atomic secured operation; either it succeeds, with all the changes committed to the database file, or if it fails, all the changes are rolled back to the initial state.

Resource Acquisition Is Initialization (RAII) means that the Transaction begins in the constructor and is rollbacked in the destructor, so that there is no need to worry about memory management or the validity of the underlying SQLite Connection.

This method also offers big performances improvements compared to individually executed statements.

Definition at line 34 of file Transaction.h.

Constructor & Destructor Documentation

SQLite::Transaction::Transaction ( Database aDatabase)
explicit

Begins the SQLite transaction.

Parameters
[in]aDatabasethe SQLite Database Connection

Exception is thrown in case of error, then the Transaction is NOT initiated.

Definition at line 18 of file Transaction.cpp.

Here is the call graph for this function:

SQLite::Transaction::~Transaction ( void  ) throw ()
virtual

Safely rollback the transaction if it has not been committed.

Definition at line 26 of file Transaction.cpp.

Here is the call graph for this function:

Member Function Documentation

void SQLite::Transaction::commit ( void  )

Commit the transaction.

Definition at line 44 of file Transaction.cpp.

Here is the call graph for this function:


The documentation for this class was generated from the following files: