Search Toolkit Book for CSQLITE_Connection
Connection to SQLite database. More...
#include <db/sqlite/sqlitewrapp.hpp>
Connection to SQLite database.
Definition at line 141 of file sqlitewrapp.hpp.
◆ THandlePool ◆ TOperationFlags ◆ EOperationFlagsFlags controlling specifics of database connection operation.
Only one flag can be used in each group of flags (separated by comments).
Enumerator fInternalMTObject and all statements and blobs created on top of it should support internal synchronization between different threads.
fExternalMTObject and all statements and blobs created on top of it will not be used from different threads simultaneously, thus performance is optimized, object creates only one low-level SQLite connection.
fDefaultMTDefault value for multi-threading group of flags.
eAllMT fVacuumOnVacuuming is on, database file has always the minimum size possible.
fVacuumOffVacuuming is off, database file can only grow.
fVacuumManualVacuuming is only by request.
fDefaultVacuumDefault value for vacuuming group of flags.
eAllVacuum fJournalDeleteJournal on disk, journal file is deleted after each transaction.
fJournalTruncateJournal on disk, size of journal file is nullified after each transaction.
fJournalPersistJournal on disk, journal file can only grow, never shrinks.
fJournalMemoryJournaling is entirely in-memory.
fJournalOffJournaling is completely off (not recommended - transactions cannot be rollbacked unless they consist of just one simple operation)
fDefaultJournalDefault value for journaling group of flags.
eAllJournal fSyncFullFull synchronization, database cannot be corrupted.
fSyncOnSynchronization is on, there is a slight chance of database corruption when OS crashes.
fSyncOffSynchronization is off, database can be corrupted on OS crash or power outage.
fDefaultSyncDefault value for synchronization group of flags.
eAllSync fTempToMemoryMode of storing temporary data.
Store all temporary tables in memory
fTempToFileUse actual disk file for temporary storage.
fDefaultTempDefault value for "temporary" group of flags.
eAllTemp fWritesSyncMode of doing all writes to the database.
All writes are synchronous - when update has executed data is already in file (though
All writes are asynchronous - updates return as quick as they can, actual writes to database happen in background thread (.
Default value for writes mode group of flags.
eAllWrites fReadOnlyThe DB is read-only. Also forces fVacuumOff flag.
eDefaultFlagsDefault value of all flags.
Definition at line 147 of file sqlitewrapp.hpp.
◆ CSQLITE_Connection() [1/2]Connect to SQLite database.
NOTE: Vacuuming flags have any value here only when new database is created. When old database is opened with some data in it then vacuuming flags are no-op, flags used at creation are in effect. NOTE: Connection should be destroyed after all statements or blobs created on top of it. destroying statements after connection was destroyed will result in segmentation fault.
Definition at line 473 of file sqlitewrapp.cpp.
References eAllJournal, eAllMT, eAllSync, eAllTemp, eAllVacuum, eAllWrites, flags, and x_CheckFlagsValidity().
Referenced by CreateInMemoryDatabase().
◆ ~CSQLITE_Connection() CSQLITE_Connection::~CSQLITE_Connection ( void ) ◆ CSQLITE_Connection() [2/2] ◆ CreateInMemoryDatabase()Create a read-only copy of the database in memory.
The in-memory database is never synchronized with the original file. If 'shared' is true, a single copy of in-memory database is used. Otherwise each call to the function creates a new database and the returned connection is the only way to access it. On error return NULL.
Definition at line 617 of file sqlitewrapp.cpp.
References CSQLITE_Connection(), dbname(), fExternalMT, file_name, fJournalOff, fReadOnly, fSyncOff, fTempToMemory, fVacuumOff, LockHandle(), NULL, and UnlockHandle().
Referenced by CLDS2_Database::x_GetConn().
◆ CreateVacuumStmt() ◆ DeleteDatabase() void CSQLITE_Connection::DeleteDatabase ( void ) ◆ ExecuteSql() void CSQLITE_Connection::ExecuteSql ( CTempString sql ) inline ◆ GetCacheSize() unsigned int CSQLITE_Connection::GetCacheSize ( void ) inlineGet recommended size of the database cache.
If cache size was not set by SetCacheSize() method then this method returns 0, though actually SQLite uses some default value.
Definition at line 837 of file sqlitewrapp.hpp.
References int, and m_CacheSize.
◆ GetFileName() const string & CSQLITE_Connection::GetFileName ( void ) const inline ◆ GetFlags() ◆ GetPageSize() unsigned int CSQLITE_Connection::GetPageSize ( void ) inline ◆ LockHandle() sqlite3 * CSQLITE_Connection::LockHandle ( void ) inlineLock and return low-level connection handle.
Definition at line 850 of file sqlitewrapp.hpp.
References eAllMT, fExternalMT, CObjPool< TObjType, TObjFactory >::Get(), m_Flags, m_HandlePool, m_InMemory, result, and CObjPool< TObjType, TObjFactory >::Return().
Referenced by CreateInMemoryDatabase(), CSQLITE_Blob::x_OpenBlob(), and CSQLITE_Statement::x_Prepare().
◆ operator=() ◆ SetCacheSize() void CSQLITE_Connection::SetCacheSize ( unsigned int size ) inline ◆ SetFlags() ◆ SetPageSize() void CSQLITE_Connection::SetPageSize ( unsigned int size ) inline ◆ SetupNewConnection() void CSQLITE_Connection::SetupNewConnection ( sqlite3 * handle )Setup newly created low-level connection handle.
Executes all necessary pragmas according to operation flags set.
Definition at line 500 of file sqlitewrapp.cpp.
References eAllJournal, eAllSync, eAllTemp, eAllVacuum, fJournalDelete, fJournalMemory, fJournalOff, fJournalPersist, fJournalTruncate, fReadOnly, fSyncFull, fSyncOff, fSyncOn, fTempToFile, fTempToMemory, fVacuumManual, fVacuumOff, fVacuumOn, NStr::IntToString(), m_CacheSize, m_Flags, m_PageSize, x_CheckFlagsValidity(), and x_ExecuteSql().
Referenced by CSQLITE_HandleFactory::CreateObject().
◆ UnlockHandle() void CSQLITE_Connection::UnlockHandle ( sqlite3 * handle ) inline ◆ Vacuum() void CSQLITE_Connection::Vacuum ( size_t max_free_size ) inline ◆ x_CheckFlagsValidity() ◆ x_ExecuteSql() void CSQLITE_Connection::x_ExecuteSql ( sqlite3 * handle, CTempString sql ) inlineprivate ◆ m_CacheSize unsigned int CSQLITE_Connection::m_CacheSize private ◆ m_FileName string CSQLITE_Connection::m_FileName private ◆ m_Flags ◆ m_HandlePool ◆ m_InMemory sqlite3* CSQLITE_Connection::m_InMemory private ◆ m_PageSize unsigned int CSQLITE_Connection::m_PageSize privateThe documentation for this class was generated from the following files:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4