NCBI C++ ToolKit
|
Search Toolkit Book for CSQLITE_Global
Utility class for some global-purpose functions tuning SQLite as a whole as opposed to tuning connection-by-connection. More...
#include <db/sqlite/sqlitewrapp.hpp>
Static Public Member Functions | |
static void | SetCustomPageCache (sqlite3_pcache_methods *methods) |
Install non-default cache for all SQLite databases. More... | |
static void | Initialize (void) |
Initialization of SQLite and tuning some default parameters. More... | |
static void | Finalize (void) |
Finish all SQLite operations. More... | |
static void | EnableSharedCache (bool enable=true) |
Enable use of the same cache by different connections to the same database file. More... | |
static sqlite3_vfs * | GetDefaultVFS (void) |
Get default virtual file system installed in SQLite. More... | |
static void | RegisterCustomVFS (sqlite3_vfs *vfs, bool set_default=true) |
Register new virtual file system in SQLite. More... | |
static void | SetAsyncWritesFileLocking (bool lock_files) |
Setup the option for asynchronous file system to do the actual locking of database files on disk. More... | |
static void | RunAsyncWritesThread (void) |
Launch background thread doing all asynchronous writes to databases. More... | |
Private Member Functions | |
CSQLITE_Global (void) | |
CSQLITE_Global (CSQLITE_Global &) | |
CSQLITE_Global & | operator= (CSQLITE_Global &) |
Utility class for some global-purpose functions tuning SQLite as a whole as opposed to tuning connection-by-connection.
Definition at line 63 of file sqlitewrapp.hpp.
|
private |
|
private |
Enable use of the same cache by different connections to the same database file.
Setting can be changed at any time and will affect all connections opened after changing.
Definition at line 334 of file sqlitewrapp.cpp.
References ERR_POST_X, and NCBI_THROW.
|
static |
Finish all SQLite operations.
Method should be called at the end of application execution. After it has been called any further attempts to use wrapper classes will likely cause application crash.
Definition at line 297 of file sqlitewrapp.cpp.
References _VERIFY, s_AsyncWritesThread, and s_SQLITE3_Initialized.
Referenced by s_Finalize(), and CGenomicCollectionsService::~CGenomicCollectionsService().
|
static |
Get default virtual file system installed in SQLite.
Method can be called only after SQLite is initialized with Initialize() method.
Definition at line 359 of file sqlitewrapp.cpp.
References NULL.
|
static |
Initialization of SQLite and tuning some default parameters.
For these SQLite wrappers to work properly this method should be called before any work with other classes.
Definition at line 319 of file sqlitewrapp.cpp.
References _VERIFY, NULL, and s_SQLITE3_Initialized.
Referenced by s_Initialize(), and CGenomicCollectionsService::x_ConfigureCache().
|
private |
Register new virtual file system in SQLite.
If set_default is TRUE then all connections that will be opened after call to this method will use this virtual file system. When set_default is FALSE then connections will have to state explicitly if they want to use this new vfs (although for now this functionality is not yet implemented in CSQLITE_Connection). Method can be called only after SQLite is initialized with Initialize() method.
Definition at line 365 of file sqlitewrapp.cpp.
References NCBI_THROW_FMT.
|
static |
Launch background thread doing all asynchronous writes to databases.
Method is no-op if background thread has already launched.
Definition at line 269 of file sqlitewrapp.cpp.
References s_AsyncWritesThread.
|
static |
Setup the option for asynchronous file system to do the actual locking of database files on disk.
If lock_files is TRUE then files will be actually locked on hard disk, if it is FALSE files will not be locked and so consistency of access to databases opened with asynchronous writing flag set will be maintained only inside current process. Method should be called only when there's no connections opened.
Definition at line 281 of file sqlitewrapp.cpp.
References ERR_POST_X.
|
static |
Install non-default cache for all SQLite databases.
Can be useful if default policy of working with cache is inappropriate for your application. For more details on sqlite3_pcache_methods look into comments before it in sqlite3.h. Method can be called only before SQLite is initialized with Initialize() method.
Definition at line 349 of file sqlitewrapp.cpp.
References NCBI_THROW_FMT.