|
Nebula
|
#include <sqlite3database.h>
SQLite3 implementation of Db::Database.
Inherits Db::Database.
Public Types | |
| enum | TempStore { File , Memory } |
| temporary storage location More... | |
Public Types inherited from Db::Database | |
| enum | AccessMode { ReadOnly , ReadWriteExisting , ReadWriteCreate } |
| access modes More... | |
Public Member Functions | |
| Sqlite3Database () | |
| constructor | |
| virtual | ~Sqlite3Database () |
| destructor | |
| void | SetCacheNumPages (SizeT numCachePages) |
| set the SQLite3 database cache size in number of pages | |
| SizeT | GetCacheNumPages () const |
| get SQLite3 database cache size | |
| void | SetTempStore (TempStore s) |
| set temporary storage location | |
| TempStore | GetTempStore () const |
| get temporary storage location | |
| void | SetSynchronousMode (bool b) |
| synchronous mode on/off | |
| bool | GetSynchronousMode () const |
| get synchronous mode | |
| void | SetBusyTimeout (int ms) |
| set busy timeout in milliseconds (default is 100, 0 disabled busy handling) | |
| int | GetBusyTimeout () const |
| get busy timeout in milliseconds | |
| virtual bool | Open () |
| open the database | |
| virtual void | Close () |
| close the database | |
| virtual bool | AttachDatabase (const IO::URI &uri, const Util::String &dbName) |
| attach another database to the current database | |
| virtual void | DetachDatabase (const Util::String &dbName) |
| detach an attached database | |
| virtual void | BeginTransaction () |
| begin a transaction on the database | |
| virtual void | EndTransaction () |
| end a transaction on the database | |
| sqlite3 * | GetSqliteHandle () const |
| get the SQLite database handle | |
| virtual void | CopyInMemoryDatabaseToFile (const IO::URI &fileUri) |
| copy in memory database to file | |
Public Member Functions inherited from Db::Database | |
| Database () | |
| constructor | |
| virtual | ~Database () |
| destructor | |
| void | SetURI (const IO::URI &uri) |
| set the data source URI (usually filename of database file) | |
| const IO::URI & | GetURI () const |
| get the database URI | |
| void | SetAccessMode (AccessMode m) |
| set the access mode (ReadOnly or ReadWrite) | |
| AccessMode | GetAccessMode () const |
| get access mode | |
| void | SetExclusiveMode (bool b) |
| enable/disable exclusive mode | |
| bool | GetExclusiveMode () const |
| get exclusive mode | |
| void | SetIgnoreUnknownColumns (bool b) |
| ignore unknown columns (not existing as attribute), yes/no | |
| bool | GetIgnoreUnknownColumns () const |
| get ignore unknown columns flag | |
| bool | IsOpen () const |
| return true if database is open | |
| const Util::String & | GetError () const |
| get last error string | |
| virtual void | AddTable (const Ptr< Table > &table) |
| create a new table in the database | |
| virtual void | DeleteTable (const Util::String &tableName) |
| delete a table from the database | |
| bool | HasTable (const Util::String &tableName) const |
| return true if a table exists by name | |
| SizeT | GetNumTables () const |
| get number of tables in the database | |
| const Ptr< Table > & | GetTableByIndex (IndexT i) const |
| get table by index | |
| const Ptr< Table > & | GetTableByName (const Util::String &tableName) const |
| get table by name | |
| void | SetInMemoryDatabase (bool b) |
| set in-memory database only | |
Public Member Functions inherited from Core::RefCounted | |
| RefCounted () | |
| constructor | |
| int | GetRefCount () const |
| get the current refcount | |
| void | AddRef () |
| increment refcount by one | |
| void | Release () |
| decrement refcount and destroy object if refcount is zero | |
| bool | IsInstanceOf (const Rtti &rtti) const |
| return true if this object is instance of given class | |
| bool | IsInstanceOf (const Util::String &className) const |
| return true if this object is instance of given class by string | |
| bool | IsInstanceOf (const Util::FourCC &classFourCC) const |
| return true if this object is instance of given class by fourcc | |
| bool | IsA (const Rtti &rtti) const |
| return true if this object is instance of given class, or a derived class | |
| bool | IsA (const Util::String &rttiName) const |
| return true if this object is instance of given class, or a derived class, by string | |
| bool | IsA (const Util::FourCC &rttiFourCC) const |
| return true if this object is instance of given class, or a derived class, by fourcc | |
| const Util::String & | GetClassName () const |
| get the class name | |
| Util::FourCC | GetClassFourCC () const |
| get the class FourCC code | |
Private Member Functions | |
| __DeclareClass (Sqlite3Database) | |
| void | ReadTableLayouts () |
| read table layouts from database | |
| void | RegisterAttributes (Ptr< Table > &attrTable) |
| dynamically register attributes from special _Attributes db table | |
Private Attributes | |
| SizeT | cacheNumPages |
| TempStore | tempStore |
| bool | syncMode |
| int | busyTimeout |
| sqlite3 * | sqliteHandle |
| Ptr< Command > | beginTransactionCmd |
| Ptr< Command > | endTransactionCmd |
Additional Inherited Members | |
Static Public Member Functions inherited from Core::RefCounted | |
| static void | DumpRefCountingLeaks () |
| dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!) | |
Protected Member Functions inherited from Db::Database | |
| void | SetError (const Util::String &error) |
| set error string | |
| IndexT | FindTableIndex (const Util::String &tableName) const |
| find a table index by name | |
Protected Member Functions inherited from Core::RefCounted | |
| virtual | ~RefCounted () |
| destructor (called when refcount reaches zero) | |
Protected Attributes inherited from Db::Database | |
| bool | isOpen |
| bool | ignoreUnknownColumns |
| IO::URI | uri |
| Util::String | error |
| AccessMode | accessMode |
| bool | memoryDatabase |
| bool | exclusiveMode |
| Util::Array< Ptr< Table > > | tables |
| Db::Sqlite3Database::Sqlite3Database | ( | ) |
constructor
|
virtual |
destructor
|
private |
|
virtual |
attach another database to the current database
This attaches an external database file to this database under the given name.
See the SQLite docs for details!
Reimplemented from Db::Database.
|
virtual |
|
virtual |
|
virtual |
copy in memory database to file
Reimplemented from Db::Database.
|
virtual |
detach an attached database
This detaches an external database from this database.
See the SQLite docs for details!
Reimplemented from Db::Database.
|
virtual |
end a transaction on the database
End the current database transaction.
Reimplemented from Db::Database.
|
inline |
get busy timeout in milliseconds
|
inline |
get SQLite3 database cache size
|
inline |
get the SQLite database handle
|
inline |
get synchronous mode
|
inline |
get temporary storage location
|
virtual |
open the database
Opens an Sqlite3 database (either opens an existing, or creates a new database).
Configures the database via pragmas, reads in existing tables.
Reimplemented from Db::Database.
|
private |
read table layouts from database
Reads in the existing database table structure, and attaches them as Table objects.
dynamically register attributes from special _Attributes db table
Registers additional attributes defined in the database's special _Attributes table.
This enables an application to function even without knowing all attributes beforehand.
FIXME: we could also check here if the attributes in the database are type-compatibel with the already existing attributes(?).
|
inline |
set busy timeout in milliseconds (default is 100, 0 disabled busy handling)
|
inline |
set the SQLite3 database cache size in number of pages
|
inline |
synchronous mode on/off
|
inline |
set temporary storage location
|
private |
|
private |
|
private |
|
private |
|
private |