glim::SqliteParQuery Class Reference

#include <sqlite.hpp>

Inheritance diagram for glim::SqliteParQuery:

glim::SqliteQuery List of all members.

Detailed Description

Version of SqliteQuery suitable for using SQLite in parallel with other processes.

Will automatically handle the SQLITE_SCHEMA error and will automatically repeat attempts after SQLITE_BUSY, but it requires that the query string supplied is constant and available during the SqliteParQuery lifetime. Error messages, contained in exceptions, may differ from SqliteQuery by containing the query (for example, the step method will throw "$query: $errmsg" instead of just "$errmsg").


Public Member Functions

 SqliteParQuery (SqliteSession *session, char const *query, int queryLength, int repeat=90, int wait=20)
 Prepares the query.
 SqliteParQuery (SqliteSession *session, std::pair< char const *, int > query, int repeat=90, int wait=20)
 Prepares the query.
bool next ()
 Synonym for step.
bool step ()
 Invokes sqlite3_step.

Protected Attributes

char const * query
int queryLength
int repeat
int wait


Constructor & Destructor Documentation

glim::SqliteParQuery::SqliteParQuery SqliteSession session,
char const *  query,
int  queryLength,
int  repeat = 90,
int  wait = 20
[inline]
 

Prepares the query.

Parameters:
repeat the number of times we try to repeat the query when SQLITE_BUSY is returned.
wait how long, in milliseconds (1/1000 of a second) we are to wait before repeating.
Exceptions:
std::runtime_error if sqlite3_prepare fails; format of the error message is "$query: $errmsg".

glim::SqliteParQuery::SqliteParQuery SqliteSession session,
std::pair< char const *, int >  query,
int  repeat = 90,
int  wait = 20
[inline]
 

Prepares the query.

Parameters:
query the SQL query together with its length.
repeat the number of times we try to repeat the query when SQLITE_BUSY is returned.
wait how long, in milliseconds (1/1000 of a second) we are to wait before repeating.
Exceptions:
std::runtime_error if sqlite3_prepare fails; format of the error message is "$query: $errmsg".


Member Function Documentation

bool glim::SqliteParQuery::step  )  [inline]
 

Invokes sqlite3_step.

Returns:
true if there was a row fetched successfully, false if there is no more rows.
See also:
http://sqlite.org/capi3ref.html#sqlite3_step

Reimplemented from glim::SqliteQuery.


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