Kompex::SQLiteDatabase Class Reference

#include <KompexSQLiteDatabase.h>

List of all members.

Public Member Functions

 SQLiteDatabase ()
 SQLiteDatabase (const char *filename, int flags, const char *zVfs)
 SQLiteDatabase (const std::string &filename, int flags, const char *zVfs)
 SQLiteDatabase (const wchar_t *filename)
virtual ~SQLiteDatabase ()
 Destructor.
void Open (const char *filename, int flags, const char *zVfs)
void Open (const std::string &filename, int flags, const char *zVfs)
void Open (const wchar_t *filename)
void Close ()
 Closes a connection to an SQLite database file.
sqlite3 * GetDatabaseHandle () const
 Returns the SQLite db handle.
int GetLibVersionNumber () const
 Returns the versionnumber of sqlite.
int GetDatabaseChanges () const
int GetTotalDatabaseChanges () const
void InterruptDatabaseOperation () const
int GetAutoCommit () const
void ActivateTracing () const
void ActivateProfiling () const
void SetSoftHeapLimit (int heapLimit) const
int ReleaseMemory (int bytesOfMemory) const

Static Protected Member Functions

static void TraceOutput (void *ptr, const char *sql)
 Callback function for ActivateTracing() [sqlite3_trace].
static void ProfileOutput (void *ptr, const char *sql, sqlite3_uint64 time)
 Callback function for ActivateProfiling() [sqlite3_profile].

Private Attributes

struct sqlite3 * mDatabaseHandle
 SQLite db handle.

Constructor & Destructor Documentation

Kompex::SQLiteDatabase::SQLiteDatabase (  ) 

Default constructor.
Closes automaticly the connection to an SQLite database file.

Kompex::SQLiteDatabase::SQLiteDatabase ( const char *  filename,
int  flags,
const char *  zVfs 
)

Overloaded constructor.
Opens a connection to an SQLite database file.

Parameters:
filename Database filename (UTF-8)
flags Flags
SQLITE_OPEN_READONLY
The database is opened in read-only mode.
If the database does not already exist, an error is returned.
SQLITE_OPEN_READWRITE
The database is opened for reading and writing if possible,
or reading only if the file is write protected by the operating system.
In either case the database must already exist, otherwise an error is returned.
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
The database is opened for reading and writing,
and is creates it if it does not already exist.
zVfs Name of VFS module to use
NULL for default
Kompex::SQLiteDatabase::SQLiteDatabase ( const std::string &  filename,
int  flags,
const char *  zVfs 
)

Overloaded constructor.
Opens a connection to an SQLite database file.

Parameters:
filename Database filename (UTF-8)
flags Flags
SQLITE_OPEN_READONLY
The database is opened in read-only mode.
If the database does not already exist, an error is returned.
SQLITE_OPEN_READWRITE
The database is opened for reading and writing if possible,
or reading only if the file is write protected by the operating system.
In either case the database must already exist, otherwise an error is returned.
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
The database is opened for reading and writing,
and is creates it if it does not already exist.
zVfs Name of VFS module to use
NULL for default
Kompex::SQLiteDatabase::SQLiteDatabase ( const wchar_t *  filename  ) 

Overloaded constructor.
Opens a connection to an SQLite database file.

Parameters:
filename Database filename (UTF-16)
Kompex::SQLiteDatabase::~SQLiteDatabase (  )  [virtual]

Destructor.


Member Function Documentation

void Kompex::SQLiteDatabase::ActivateProfiling (  )  const [inline]

Profile() is invoked as each SQL statement finishes.
The profile callback contains the original statement text
and an estimate of wall-clock time of how long that statement took to run.
Note: time in ns
Output: std::cout

void Kompex::SQLiteDatabase::ActivateTracing (  )  const [inline]

Trace() is invoked at various times when an SQL statement is being run by FetchRow(), SqlStatement() or ExecuteAndFree().
The callback returns a UTF-8 rendering of the SQL statement text as the statement first begins executing.
Output: std::cout

void Kompex::SQLiteDatabase::Close (  ) 

Closes a connection to an SQLite database file.

int Kompex::SQLiteDatabase::GetAutoCommit (  )  const [inline]

Returns non-zero or zero if the given database connection is or is not in autocommit mode, respectively.
Autocommit mode is on by default. Autocommit mode is disabled by a BEGIN statement.
Autocommit mode is re-enabled by a COMMIT or ROLLBACK.

int Kompex::SQLiteDatabase::GetDatabaseChanges (  )  const [inline]

Returns the number of database rows that were changed or inserted or deleted
by the most recently completed SQL statement.

sqlite3* Kompex::SQLiteDatabase::GetDatabaseHandle (  )  const [inline]

Returns the SQLite db handle.

int Kompex::SQLiteDatabase::GetLibVersionNumber (  )  const [inline]

Returns the versionnumber of sqlite.

int Kompex::SQLiteDatabase::GetTotalDatabaseChanges (  )  const [inline]

Returns the total number of row changes caused by INSERT, UPDATE or DELETE statements
since the database connection was opened. The count includes all changes from all trigger contexts.
However, the count does not include changes used to implement REPLACE constraints,
do rollbacks or ABORT processing, or DROP table processing.
The changes are counted as soon as the statement that makes them is completed.

void Kompex::SQLiteDatabase::InterruptDatabaseOperation (  )  const [inline]

Causes any pending database operation to abort and return at its earliest opportunity.
This routine is typically called in response to a user action such as pressing "Cancel"
or Ctrl-C where the user wants a long query operation to halt immediately.

void Kompex::SQLiteDatabase::Open ( const wchar_t *  filename  ) 

Opens a connection to an SQLite database file.
Shut down existing database handle, if one exist.

Parameters:
filename Database filename (UTF-16)
void Kompex::SQLiteDatabase::Open ( const std::string &  filename,
int  flags,
const char *  zVfs 
)

Opens a connection to an SQLite database file. Shut down existing database handle, if one exist.

Parameters:
filename Database filename (UTF-8)
flags Flags
SQLITE_OPEN_READONLY
The database is opened in read-only mode.
If the database does not already exist, an error is returned.
SQLITE_OPEN_READWRITE
The database is opened for reading and writing if possible,
or reading only if the file is write protected by the operating system.
In either case the database must already exist, otherwise an error is returned.
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
The database is opened for reading and writing,
and is creates it if it does not already exist.
zVfs Name of VFS module to use
NULL for default
void Kompex::SQLiteDatabase::Open ( const char *  filename,
int  flags,
const char *  zVfs 
)

Opens a connection to an SQLite database file.
Shut down existing database handle, if one exist.

Parameters:
filename Database filename (UTF-8)
flags Flags
SQLITE_OPEN_READONLY
The database is opened in read-only mode.
If the database does not already exist, an error is returned.
SQLITE_OPEN_READWRITE
The database is opened for reading and writing if possible,
or reading only if the file is write protected by the operating system.
In either case the database must already exist, otherwise an error is returned.
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
The database is opened for reading and writing,
and is creates it if it does not already exist.
zVfs Name of VFS module to use
NULL for default
void Kompex::SQLiteDatabase::ProfileOutput ( void *  ptr,
const char *  sql,
sqlite3_uint64  time 
) [static, protected]

Callback function for ActivateProfiling() [sqlite3_profile].

int Kompex::SQLiteDatabase::ReleaseMemory ( int  bytesOfMemory  )  const [inline]

The ReleaseMemory() interface attempts to free N bytes of heap memory by deallocating
non-essential memory allocations held by the database library.
Memory used to cache database pages to improve performance is an example of non-essential memory.
ReleaseMemory() returns the number of bytes actually freed, which might be more or less than the amount requested.

Parameters:
bytesOfMemory Memory in bytes, which should be freed
void Kompex::SQLiteDatabase::SetSoftHeapLimit ( int  heapLimit  )  const [inline]

The SetSoftHeapLimit() interface places a "soft" limit on the amount of heap memory that may be allocated by SQLite.
If an internal allocation is requested that would exceed the soft heap limit, sqlite3_release_memory()
is invoked one or more times to free up some space before the allocation is performed. The limit is called "soft", because if sqlite3_release_memory() cannot free sufficient memory to prevent the limit from being exceeded,
the memory is allocated anyway and the current operation proceeds. A negative or zero value for heapLimit means that there is no soft heap limit and sqlite3_release_memory()
will only be called when memory is exhausted. The default value for the soft heap limit is zero.

Parameters:
heapLimit Heap limit in bytes.
void Kompex::SQLiteDatabase::TraceOutput ( void *  ptr,
const char *  sql 
) [static, protected]

Callback function for ActivateTracing() [sqlite3_trace].


Member Data Documentation

struct sqlite3* Kompex::SQLiteDatabase::mDatabaseHandle [private]

SQLite db handle.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Defines
Generated on Thu May 20 00:15:56 2010 for Kompex SQLite Wrapper by  doxygen 1.6.3