dodo
0.0.1
A C++ library to create containerized Linux services
|
A STL friendly wrapper around the great sqlite3. More...
#include <sqlite.hpp>
Public Member Functions | |
Database (const std::string &filename, WaitHandler handler=0) | |
Constructor with explicit wait handler. More... | |
~Database () | |
Destructor. More... | |
void | beginExclusiveTransaction () |
Begin an exclusive transaction. More... | |
void | beginImmediateTransaction () |
Begin an immediate transaction. More... | |
void | beginTransaction () |
Begin a transaction. More... | |
void | checkPointFull () |
Issue a full checpoint. More... | |
void | checkPointPassive () |
Issue a passive checpoint. More... | |
void | checkPointTruncate () |
Issue a (WAL) truncate checpoint. More... | |
void | commit () |
Commit a transaction. More... | |
void | createSavepoint (const std::string &sp) |
Create a named savepoint. More... | |
void | disableForeignKeys () |
Disable foreign key constraints. More... | |
void | enableForeignKeys () |
Enable foreign key constraints. More... | |
void | enableTriggers () |
Enable triggers. More... | |
sqlite3 * | getDB () const |
Return database handle. More... | |
std::string | getFileName () const |
Return the database filename. More... | |
int | getUserVersion () const |
get the current user_version pragma (a user defined database schema version) More... | |
int64_t | lastInsertRowid () const |
Get the rowid of the last inserted row. More... | |
void | releaseMemory () |
Have SQLite attempt to release a much memory as possible. More... | |
void | releaseSavepoint (const std::string &sp) |
Release a savepoint. More... | |
void | rollback () |
Rollback a transaction. More... | |
void | rollback (const std::string &sp) |
Rollback to a savepoint. More... | |
void | setUserVersion (int version) |
set the user_version pragma More... | |
Static Public Member Functions | |
static int64_t | memHighWater () |
Get memory highwater by the SQLite library. More... | |
static int64_t | memUsed () |
Get memory in use by the SQLite library. More... | |
static int64_t | softHeapLimit (int64_t limit) |
Set the SQLite soft heap limit - ask SQLite to strive to limit its memory use (caching). More... | |
Protected Attributes | |
sqlite3 * | database_ |
The SQLite database handle. More... | |
A STL friendly wrapper around the great sqlite3.
A few extension functions are added for use in SQL
Definition at line 52 of file sqlite.hpp.
dodo::persist::sqlite::Database::Database | ( | const std::string & | filename, |
WaitHandler | handler = 0 |
||
) |
Constructor with explicit wait handler.
filename | the database filename |
handler | the wait handler |
Definition at line 131 of file sqlite.cpp.
References database_, dodo::persist::sqlite::sqlite_ext_ceil(), dodo::persist::sqlite::sqlite_ext_floor(), dodo::persist::sqlite::sqlite_ext_log2(), dodo::persist::sqlite::sqlite_ext_pow(), and throw_Exception.
dodo::persist::sqlite::Database::~Database | ( | ) |
void dodo::persist::sqlite::Database::beginExclusiveTransaction | ( | ) |
Begin an exclusive transaction.
Definition at line 239 of file sqlite.cpp.
References dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().
void dodo::persist::sqlite::Database::beginImmediateTransaction | ( | ) |
Begin an immediate transaction.
Definition at line 231 of file sqlite.cpp.
References dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().
void dodo::persist::sqlite::Database::beginTransaction | ( | ) |
Begin a transaction.
Definition at line 223 of file sqlite.cpp.
References dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().
void dodo::persist::sqlite::Database::checkPointFull | ( | ) |
Issue a full checpoint.
Definition at line 295 of file sqlite.cpp.
References database_, and throw_Exception.
Referenced by dodo::persist::KVStore::checkpoint().
void dodo::persist::sqlite::Database::checkPointPassive | ( | ) |
Issue a passive checpoint.
Definition at line 304 of file sqlite.cpp.
References database_, and throw_Exception.
void dodo::persist::sqlite::Database::checkPointTruncate | ( | ) |
Issue a (WAL) truncate checpoint.
Definition at line 313 of file sqlite.cpp.
References database_, and throw_Exception.
void dodo::persist::sqlite::Database::commit | ( | ) |
Commit a transaction.
Definition at line 247 of file sqlite.cpp.
References dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().
Referenced by dodo::persist::KVStore::commitTransaction().
void dodo::persist::sqlite::Database::createSavepoint | ( | const std::string & | sp | ) |
Create a named savepoint.
sp | the savepoint name |
Definition at line 263 of file sqlite.cpp.
References dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().
void dodo::persist::sqlite::Database::disableForeignKeys | ( | ) |
Disable foreign key constraints.
Definition at line 207 of file sqlite.cpp.
References database_, and throw_Exception.
void dodo::persist::sqlite::Database::enableForeignKeys | ( | ) |
Enable foreign key constraints.
Definition at line 199 of file sqlite.cpp.
References database_, and throw_Exception.
void dodo::persist::sqlite::Database::enableTriggers | ( | ) |
Enable triggers.
Definition at line 215 of file sqlite.cpp.
References database_, and throw_Exception.
|
inline |
Return database handle.
Definition at line 128 of file sqlite.hpp.
References database_.
Referenced by dodo::persist::sqlite::Statement::Statement().
|
inline |
Return the database filename.
Definition at line 122 of file sqlite.hpp.
References database_.
int dodo::persist::sqlite::Database::getUserVersion | ( | ) | const |
get the current user_version pragma (a user defined database schema version)
Definition at line 334 of file sqlite.cpp.
References database_, dodo::persist::sqlite::Query::getInt(), dodo::persist::sqlite::Statement::prepare(), dodo::persist::sqlite::Query::step(), and throw_Exception.
int64_t dodo::persist::sqlite::Database::lastInsertRowid | ( | ) | const |
Get the rowid of the last inserted row.
Definition at line 287 of file sqlite.cpp.
References database_, and throw_Exception.
|
inlinestatic |
Get memory highwater by the SQLite library.
Definition at line 154 of file sqlite.hpp.
|
inlinestatic |
Get memory in use by the SQLite library.
Definition at line 146 of file sqlite.hpp.
void dodo::persist::sqlite::Database::releaseMemory | ( | ) |
Have SQLite attempt to release a much memory as possible.
Definition at line 344 of file sqlite.cpp.
References database_.
void dodo::persist::sqlite::Database::releaseSavepoint | ( | const std::string & | sp | ) |
Release a savepoint.
sp | the savepoint name |
Definition at line 271 of file sqlite.cpp.
References dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().
void dodo::persist::sqlite::Database::rollback | ( | ) |
Rollback a transaction.
Definition at line 255 of file sqlite.cpp.
References dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().
Referenced by dodo::persist::KVStore::rollbackTransaction().
void dodo::persist::sqlite::Database::rollback | ( | const std::string & | sp | ) |
Rollback to a savepoint.
sp | the savepoint name |
Definition at line 279 of file sqlite.cpp.
References dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().
void dodo::persist::sqlite::Database::setUserVersion | ( | int | version | ) |
set the user_version pragma
version | The user version to set. |
Definition at line 326 of file sqlite.cpp.
References dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().
|
inlinestatic |
Set the SQLite soft heap limit - ask SQLite to strive to limit its memory use (caching).
A value of 0 disables the limit.
limit | The limit to set. |
Definition at line 198 of file sqlite.hpp.
|
protected |
The SQLite database handle.
Definition at line 204 of file sqlite.hpp.
Referenced by checkPointFull(), checkPointPassive(), checkPointTruncate(), Database(), disableForeignKeys(), enableForeignKeys(), enableTriggers(), getDB(), getFileName(), getUserVersion(), lastInsertRowid(), releaseMemory(), and ~Database().