A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/classCSQLITE__Connection.html below:

NCBI C++ ToolKit: CSQLITE_Connection Class Reference

Search Toolkit Book for CSQLITE_Connection

Connection to SQLite database. More...

#include <db/sqlite/sqlitewrapp.hpp>

enum   EOperationFlags {
  fInternalMT = 0x00 , fExternalMT = 0x01 , fDefaultMT = fInternalMT , eAllMT = fInternalMT + fExternalMT ,
  fVacuumOn = 0x00 , fVacuumOff = 0x02 , fVacuumManual = 0x04 , fDefaultVacuum = fVacuumOn ,
  eAllVacuum = fVacuumOn + fVacuumOff + fVacuumManual , fJournalDelete = 0x00 , fJournalTruncate = 0x08 , fJournalPersist = 0x10 ,
  fJournalMemory = 0x20 , fJournalOff = 0x40 , fDefaultJournal = fJournalDelete , eAllJournal ,
  fSyncFull = 0x000 , fSyncOn = 0x080 , fSyncOff = 0x100 , fDefaultSync = fSyncFull ,
  eAllSync = fSyncOff + fSyncOn + fSyncFull , fTempToMemory = 0x000 , fTempToFile = 0x200 , fDefaultTemp = fTempToMemory ,
  eAllTemp = fTempToMemory + fTempToFile , fWritesSync = 0x000 , fWritesAsync = 0x400 , fDefaultWrites = fWritesSync ,
  eAllWrites , fReadOnly = 0x8000 , eDefaultFlags
}   Flags controlling specifics of database connection operation. More...
  typedef int  TOperationFlags   Bit mask of EOperationFlags. More...
 

Connection to SQLite database.

Definition at line 141 of file sqlitewrapp.hpp.

◆ THandlePool ◆ TOperationFlags ◆ EOperationFlags

Flags controlling specifics of database connection operation.

Only one flag can be used in each group of flags (separated by comments).

Enumerator fInternalMT 

Object and all statements and blobs created on top of it should support internal synchronization between different threads.

fExternalMT 

Object 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.

fDefaultMT 

Default value for multi-threading group of flags.

eAllMT  fVacuumOn 

Vacuuming is on, database file has always the minimum size possible.

fVacuumOff 

Vacuuming is off, database file can only grow.

fVacuumManual 

Vacuuming is only by request.

fDefaultVacuum 

Default value for vacuuming group of flags.

eAllVacuum  fJournalDelete 

Journal on disk, journal file is deleted after each transaction.

fJournalTruncate 

Journal on disk, size of journal file is nullified after each transaction.

fJournalPersist 

Journal on disk, journal file can only grow, never shrinks.

fJournalMemory 

Journaling is entirely in-memory.

fJournalOff 

Journaling is completely off (not recommended - transactions cannot be rollbacked unless they consist of just one simple operation)

fDefaultJournal 

Default value for journaling group of flags.

eAllJournal  fSyncFull 

Full synchronization, database cannot be corrupted.

fSyncOn 

Synchronization is on, there is a slight chance of database corruption when OS crashes.

fSyncOff 

Synchronization is off, database can be corrupted on OS crash or power outage.

fDefaultSync 

Default value for synchronization group of flags.

eAllSync  fTempToMemory 

Mode of storing temporary data.

Store all temporary tables in memory

fTempToFile 

Use actual disk file for temporary storage.

fDefaultTemp 

Default value for "temporary" group of flags.

eAllTemp  fWritesSync 

Mode of doing all writes to the database.

All writes are synchronous - when update has executed data is already in file (though

See also
fSyncOff)
fWritesAsync 

All writes are asynchronous - updates return as quick as they can, actual writes to database happen in background thread (.

See also
CSQLITE_Global::RunAsyncWritesThread)
fDefaultWrites 

Default value for writes mode group of flags.

eAllWrites  fReadOnly 

The DB is read-only. Also forces fVacuumOff flag.

eDefaultFlags 

Default 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.

Parameters
file_name File name of SQLite database. If it doesn't exist it will be created. If directory for file doesn't exist exception will be thrown. If file name is empty connection to temporary file will be open. This file will be deleted after connection is closed. If file name is ":memory:" then connection to in-memory database will be open. In both cases (temporary file and in-memory database) flag fExternalMT should be set (it is not checked but you will get malfunctioning otherwise). flags Flags for object operations

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  ) inline

Get 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  ) inline

Lock 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 private

The 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