NCBI C++ ToolKit
Static Public Member Functions | Private Member Functions | List of all members
CSQLITE_Global Class Reference

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_Globaloperator= (CSQLITE_Global &)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CSQLITE_Global() [1/2]

CSQLITE_Global::CSQLITE_Global ( void  )
private

◆ CSQLITE_Global() [2/2]

CSQLITE_Global::CSQLITE_Global ( CSQLITE_Global )
private

Member Function Documentation

◆ EnableSharedCache()

void CSQLITE_Global::EnableSharedCache ( bool  enable = true)
static

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.

◆ Finalize()

void CSQLITE_Global::Finalize ( void  )
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().

◆ GetDefaultVFS()

sqlite3_vfs * CSQLITE_Global::GetDefaultVFS ( void  )
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.

◆ Initialize()

void CSQLITE_Global::Initialize ( void  )
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().

◆ operator=()

CSQLITE_Global& CSQLITE_Global::operator= ( CSQLITE_Global )
private

◆ RegisterCustomVFS()

void CSQLITE_Global::RegisterCustomVFS ( sqlite3_vfs *  vfs,
bool  set_default = true 
)
static

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.

◆ RunAsyncWritesThread()

void CSQLITE_Global::RunAsyncWritesThread ( void  )
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.

◆ SetAsyncWritesFileLocking()

void CSQLITE_Global::SetAsyncWritesFileLocking ( bool  lock_files)
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.

◆ SetCustomPageCache()

void CSQLITE_Global::SetCustomPageCache ( sqlite3_pcache_methods *  methods)
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.


The documentation for this class was generated from the following files:
Modified on Wed May 29 18:35:12 2024 by modify_doxy.py rev. 669887