glim::SqliteSession Class Reference

#include <sqlite.hpp>

List of all members.


Detailed Description

A single thread session with Sqlite.

Only a sigle thread at a time can have an SqliteSession, all other threads will wait, in the SqliteSession constructor, till the active session is either closed or destructed.


Public Member Functions

 SqliteSession (Sqlite *sqlite)
 Locks the database.
template<typename T>
SqliteQuery query (T t)
 A shorter way to construct query from the session.
 ~SqliteSession ()
 Automatically unlocks the database.
void close ()
 Unlock the database.
bool isClosed () const
 True if the close method has been already called on this SqliteSession.
 operator::sqlite3 * () const
 This class can be used in place of the SQLite handler.

Protected Attributes

Sqlitedb


Constructor & Destructor Documentation

glim::SqliteSession::SqliteSession Sqlite sqlite  )  [inline]
 

Locks the database.

Exceptions:
std::runtime_error if a mutex error occurs.

glim::SqliteSession::~SqliteSession  )  [inline]
 

Automatically unlocks the database.

See also:
close


Member Function Documentation

void glim::SqliteSession::close  )  [inline]
 

Unlock the database.

It is safe to call this method multiple times.
You must not use the session after it was closed.
All resources allocated within this session must be released before the session is closed.

Exceptions:
std::runtime_error if a mutex error occurs.

glim::SqliteSession::operator::sqlite3 *  )  const [inline]
 

This class can be used in place of the SQLite handler.

Make sure you've released any resources thus manually acquired before this SqliteSession is closed. Usage example:

 glim::Sqlite db (":memory:");
 glim::SqliteSession ses (&db);
 sqlite3_exec (ses, "PRAGMA page_size = 4096;", NULL, NULL, NULL);

template<typename T>
SqliteQuery glim::SqliteSession::query t  ) 
 

A shorter way to construct query from the session.

Usage example:

 ses.query(S("create table test (i integer)")).step() 
See also:
SqliteQuery::qstep


Generated on Fri Nov 24 20:57:37 2006 for libglim by  doxygen 1.4.6