Public Member Functions | Protected Member Functions | Private Types | Private Attributes

Kompex::SQLiteStatement Class Reference

#include <KompexSQLiteStatement.h>

List of all members.

Public Member Functions

 SQLiteStatement (SQLiteDatabase *db)
virtual ~SQLiteStatement ()
 Destructor.
void SqlStatement (const std::string &sqlStatement)
void SqlStatement (const char *sqlStatement)
void SqlStatement (const wchar_t *sqlStatement)
void Sql (const std::string &sql)
void Sql (const wchar_t *sql)
void Sql (const char *sql)
bool FetchRow () const
 If you have called Sql(), you can step throw all results.
void FreeQuery ()
 Call FreeQuery() after Sql() and FetchRow() to clean-up.
float SqlAggregateFuncResult (const std::string &countSql)
float SqlAggregateFuncResult (wchar_t *countSql)
float SqlAggregateFuncResult (const char *countSql)
const char * GetColumnName (int column) const
wchar_t * GetColumnName16 (int column) const
int GetColumnType (int column) const
const unsigned char * GetColumnCString (int column) const
std::string GetColumnString (int column) const
wchar_t * GetColumnString16 (int column) const
double GetColumnDouble (int column) const
int GetColumnInt (int column) const
int64 GetColumnInt64 (int column) const
const void * GetColumnBlob (int column) const
int GetColumnCount () const
int GetColumnBytes (int column) const
int GetColumnBytes16 (int column) const
const char * GetColumnDatabaseName (int column) const
wchar_t * GetColumnDatabaseName16 (int column) const
const char * GetColumnTableName (int column) const
wchar_t * GetColumnTableName16 (int column) const
const char * GetColumnOriginName (int column) const
wchar_t * GetColumnOriginName16 (int column) const
const char * GetColumnDeclaredDatatype (int column) const
wchar_t * GetColumnDeclaredDatatype16 (int column) const
int GetDataCount () const
void BindInt (int column, int value) const
void BindString (int column, const std::string &string) const
void BindString16 (int column, const wchar_t *string) const
void BindDouble (int column, double value) const
void BindInt64 (int column, int64 value) const
void BindNull (int column) const
void BindBlob (int column, const void *data, int numberOfBytes=-1) const
void BindZeroBlob (int column, int length) const
void ExecuteAndFree ()
void GetTable (const std::string &sql, unsigned short consoleOutputColumnWidth=20) const
void GetTableColumnMetadata (const std::string &tableName, const std::string &columnName) const
void ClearBindings () const
void Reset () const
void BeginTransaction ()
 Begins a transaction.
void CommitTransaction ()
void RollbackTransaction ()
 Rollback a transaction.
void Transaction (const char *sql)
void Transaction (const std::string &sql)
void Transaction (const wchar_t *sql)
void SecureTransaction (const char *sql)
void SecureTransaction (const std::string sql)
void SecureTransaction (const wchar_t *sql)
std::string GetSqlResultString (const std::string &sql, const std::string &defaultReturnValue="")
std::string GetSqlResultString (const char *sql, const std::string &defaultReturnValue="")
std::string GetSqlResultString (const wchar_t *sql, const std::string &defaultReturnValue="")
int GetSqlResultInt (const std::string &sql, int defaultReturnValue=-1)
int GetSqlResultInt (const char *sql, int defaultReturnValue=-1)
int GetSqlResultInt (const wchar_t *sql, int defaultReturnValue=-1)
int64 GetSqlResultInt64 (const std::string &sql, int64 defaultReturnValue=-1)
int64 GetSqlResultInt64 (const char *sql, int64 defaultReturnValue=-1)
int64 GetSqlResultInt64 (const wchar_t *sql, int64 defaultReturnValue=-1)
double GetSqlResultDouble (const std::string &sql, double defaultReturnValue=-1)
double GetSqlResultDouble (const char *sql, double defaultReturnValue=-1)
double GetSqlResultDouble (const wchar_t *sql, double defaultReturnValue=-1)
const unsigned char * GetSqlResultCString (const std::string &sql, const unsigned char *defaultReturnValue=0)
const unsigned char * GetSqlResultCString (const char *sql, const unsigned char *defaultReturnValue=0)
const unsigned char * GetSqlResultCString (const wchar_t *sql, const unsigned char *defaultReturnValue=0)
wchar_t * GetSqlResultString16 (const std::string &sql, wchar_t *defaultReturnValue=0)
wchar_t * GetSqlResultString16 (const char *sql, wchar_t *defaultReturnValue=0)
wchar_t * GetSqlResultString16 (const wchar_t *sql, wchar_t *defaultReturnValue=0)
const void * GetSqlResultBlob (const std::string &sql, const void *defaultReturnValue=0)
const void * GetSqlResultBlob (const char *sql, const void *defaultReturnValue=0)
const void * GetSqlResultBlob (const wchar_t *sql, const void *defaultReturnValue=0)
unsigned int GetNumberOfRows ()
 After you have called the Sql() function you can get the number of rows which were returned as result.

Protected Member Functions

void Prepare (const char *sqlStatement)
void Prepare (const wchar_t *sqlStatement)
bool Step () const
 Must be called one or more times to evaluate the statement.
void CheckStatement () const
 Checks if the statement pointer is valid.
void CheckDatabase () const
 Checks if the database pointer is valid.
void FreeAllStatements ()
 Clean-up all statements.
void CleanUpTransaction ()
 Free the allocated memory and clean the containers.
template<class T >
void DeleteTransactionSqlStr (bool isMemAllocated, T *str)
template<class S , class T >
GetColumnValue (S sql, T(Kompex::SQLiteStatement::*getColumnFunc)(int columnNumber) const, T defaultReturnValue)

Private Types

typedef std::map< unsigned
short, std::pair< const char
*, bool > > 
TTransactionSQL
 typedef for UTF-8 transaction statements
typedef std::map< unsigned
short, std::pair< const
wchar_t *, bool > > 
TTransactionSQL16
 typedef for UTF-16 transaction statements

Private Attributes

struct sqlite3_stmt * mStatement
 SQL statement.
SQLiteDatabasemDatabase
 Database pointer.
TTransactionSQL mTransactionSQL
 Stores UTF-8 transaction statements.
TTransactionSQL16 mTransactionSQL16
 Stores UTF-16 transaction statements.
unsigned short mTransactionID
 id for transactions

Member Typedef Documentation

typedef std::map<unsigned short , std::pair<const char* , bool > > Kompex::SQLiteStatement::TTransactionSQL [private]

typedef for UTF-8 transaction statements

typedef std::map<unsigned short , std::pair<const wchar_t* , bool > > Kompex::SQLiteStatement::TTransactionSQL16 [private]

typedef for UTF-16 transaction statements


Constructor & Destructor Documentation

Kompex::SQLiteStatement::SQLiteStatement ( SQLiteDatabase db )

Constructor.

Parameters:
dbDatabase in which the SQL should be performed
Kompex::SQLiteStatement::~SQLiteStatement (  ) [virtual]

Destructor.


Member Function Documentation

void Kompex::SQLiteStatement::BeginTransaction (  )

Begins a transaction.

void Kompex::SQLiteStatement::BindBlob ( int  column,
const void *  data,
int  numberOfBytes = -1 
) const

Overrides prior binding on the same parameter with a BLOB.
You must call Sql() one time, before you can use Bind..() methods!

Parameters:
columnColumn, in which the data should be inserted
dataBLOB data which should inserted in the indicated column
numberOfBytesThe size of the second parameter (const void *data) in bytes.
Please pay attention, that numberOfBytes is not the number of characters! Default: -1.
Negative numberOfBytes means, that the length of the string is the number of
bytes up to the first zero terminator.
void Kompex::SQLiteStatement::BindDouble ( int  column,
double  value 
) const

Overrides prior binding on the same parameter with a double value.
You must call Sql() one time, before you can use Bind..() methods!

Parameters:
columnColumn, in which the data should be inserted
valuedouble value which should inserted in the indicated column
void Kompex::SQLiteStatement::BindInt ( int  column,
int  value 
) const

Overrides prior binding on the same parameter with an int value.
You must call Sql() one time, before you can use Bind..() methods!

Parameters:
columnColumn, in which the data should be inserted
valueint value which should inserted in the indicated column
void Kompex::SQLiteStatement::BindInt64 ( int  column,
int64  value 
) const

Overrides prior binding on the same parameter with an int64 value.
You must call Sql() one time, before you can use Bind..() methods!

Parameters:
columnColumn, in which the data should be inserted
valueint64 value which should inserted in the indicated column
void Kompex::SQLiteStatement::BindNull ( int  column ) const

Overrides prior binding on the same parameter with NULL.
You must call Sql() one time, before you can use Bind..() methods!

Parameters:
columnColumn, in which the data should be inserted
void Kompex::SQLiteStatement::BindString ( int  column,
const std::string &  string 
) const

Overrides prior binding on the same parameter with an UTF-8 string.
You must call Sql() one time, before you can use Bind..() methods!

Parameters:
columnColumn, in which the data should be inserted
stringUTF-8 string which should inserted in the indicated column
void Kompex::SQLiteStatement::BindString16 ( int  column,
const wchar_t *  string 
) const

Overrides prior binding on the same parameter with an UTF-16 string.
You must call Sql() one time, before you can use Bind..() methods!

Parameters:
columnColumn, in which the data should be inserted
stringUTF-16 string which should inserted in the indicated column
void Kompex::SQLiteStatement::BindZeroBlob ( int  column,
int  length 
) const

Overrides prior binding on the same parameter with a blob that is filled with zeroes.
You must call Sql() one time, before you can use Bind..() methods!

Parameters:
columnColumn, in which the data should be inserted
lengthlength of BLOB, which is filled with zeroes
void Kompex::SQLiteStatement::CheckDatabase (  ) const [protected]

Checks if the database pointer is valid.

void Kompex::SQLiteStatement::CheckStatement (  ) const [protected]

Checks if the statement pointer is valid.

void Kompex::SQLiteStatement::CleanUpTransaction (  ) [protected]

Free the allocated memory and clean the containers.

void Kompex::SQLiteStatement::ClearBindings (  ) const

Resets all SQL parameter bindings back to NULL.
ClearBindings() does not reset the bindings on a prepared statement!

void Kompex::SQLiteStatement::CommitTransaction (  )

Commits a transaction.
Exception output: std::cerr

template<class T >
void Kompex::SQLiteStatement::DeleteTransactionSqlStr ( bool  isMemAllocated,
T *  str 
) [inline, protected]

Free the allocated memory of sql statements

Parameters:
isMemAllocatedWas memory allocated?
strSQL statement string
void Kompex::SQLiteStatement::ExecuteAndFree (  )

Executes a INSERT statement and clean-up.
You must first call Sql() and Bind..() methods!

bool Kompex::SQLiteStatement::FetchRow (  ) const

If you have called Sql(), you can step throw all results.

void Kompex::SQLiteStatement::FreeAllStatements (  ) [protected]

Clean-up all statements.

void Kompex::SQLiteStatement::FreeQuery (  )

Call FreeQuery() after Sql() and FetchRow() to clean-up.

const void * Kompex::SQLiteStatement::GetColumnBlob ( int  column ) const

Returns a void* from a single column of the current result row of a query.
You must first call Sql()!

int Kompex::SQLiteStatement::GetColumnBytes ( int  column ) const

Returns the number of bytes in a column that has type BLOB or the number of bytes in a TEXT string with UTF-8 encoding.
You must first call Sql()!

int Kompex::SQLiteStatement::GetColumnBytes16 ( int  column ) const

Returns the same value for BLOBs but for TEXT strings returns the number of bytes in a UTF-16 encoding.
You must first call Sql()!

int Kompex::SQLiteStatement::GetColumnCount (  ) const

Return the number of columns in the result set.
You must first call Sql()!

const unsigned char * Kompex::SQLiteStatement::GetColumnCString ( int  column ) const

Returns a character-string from a single column of the current result row of a query.
You must first call Sql()!

const char * Kompex::SQLiteStatement::GetColumnDatabaseName ( int  column ) const

Returns a UTF-8 zero-terminated name of the database.
You must first call Sql()!

wchar_t * Kompex::SQLiteStatement::GetColumnDatabaseName16 ( int  column ) const

Returns a UTF-16 zero-terminated name of the database.
You must first call Sql()!

const char * Kompex::SQLiteStatement::GetColumnDeclaredDatatype ( int  column ) const

Returns a zero-terminated UTF-8 string containing the declared datatype of the table column.
You must first call Sql()!

wchar_t * Kompex::SQLiteStatement::GetColumnDeclaredDatatype16 ( int  column ) const

Returns a zero-terminated UTF-16 string containing the declared datatype of the table column.
You must first call Sql()!

double Kompex::SQLiteStatement::GetColumnDouble ( int  column ) const

Returns a double from a single column of the current result row of a query.
You must first call Sql()!

int Kompex::SQLiteStatement::GetColumnInt ( int  column ) const

Returns a int from a single column of the current result row of a query.
You must first call Sql()!

int64 Kompex::SQLiteStatement::GetColumnInt64 ( int  column ) const

Returns a int64 from a single column of the current result row of a query.
You must first call Sql()!

const char * Kompex::SQLiteStatement::GetColumnName ( int  column ) const

Returns the name (UTF-8) assigned to a particular column in the result set of a SELECT statement.
You must first call Sql()!

wchar_t * Kompex::SQLiteStatement::GetColumnName16 ( int  column ) const

Returns the name (UTF-16) assigned to a particular column in the result set of a SELECT statement.
You must first call Sql()!

const char * Kompex::SQLiteStatement::GetColumnOriginName ( int  column ) const

Returns a UTF-8 zero-terminated name of the table column.
You must first call Sql()!

wchar_t * Kompex::SQLiteStatement::GetColumnOriginName16 ( int  column ) const

Returns a UTF-16 zero-terminated name of the table column.
You must first call Sql()!

std::string Kompex::SQLiteStatement::GetColumnString ( int  column ) const

Returns a std::string from a single column of the current result row of a query.
You must first call Sql()!

wchar_t * Kompex::SQLiteStatement::GetColumnString16 ( int  column ) const

Returns a UTF-16 string from a single column of the current result row of a query.
You must first call Sql()!

const char * Kompex::SQLiteStatement::GetColumnTableName ( int  column ) const

Returns a UTF-8 zero-terminated name of the table.
You must first call Sql()!

wchar_t * Kompex::SQLiteStatement::GetColumnTableName16 ( int  column ) const

Returns a UTF-16 zero-terminated name of the table.
You must first call Sql()!

int Kompex::SQLiteStatement::GetColumnType ( int  column ) const

Returns the datatype code for the initial data type of the result column.
SQLITE_INTEGER 1
SQLITE_FLOAT 2
SQLITE_TEXT 3
SQLITE3_TEXT 3
SQLITE_BLOB 4
SQLITE_NULL 5
You must first call Sql()!

template<class S , class T >
T Kompex::SQLiteStatement::GetColumnValue ( sql,
T(Kompex::SQLiteStatement::*)(int columnNumber) const   getColumnFunc,
defaultReturnValue 
) [protected]

Returns the first value of the first row from the given sql statement result.

Parameters:
sqlSQL statement
getColumnFuncFunction to get the SQL statement result
defaultReturnValueDefault return value when the SQL statement has no result
int Kompex::SQLiteStatement::GetDataCount (  ) const [inline]

Returns the number of values in the current row of the result set.
You must first call Sql()!

unsigned int Kompex::SQLiteStatement::GetNumberOfRows (  )

After you have called the Sql() function you can get the number of rows which were returned as result.

const void * Kompex::SQLiteStatement::GetSqlResultBlob ( const char *  sql,
const void *  defaultReturnValue = 0 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
const void * Kompex::SQLiteStatement::GetSqlResultBlob ( const wchar_t *  sql,
const void *  defaultReturnValue = 0 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
const void * Kompex::SQLiteStatement::GetSqlResultBlob ( const std::string &  sql,
const void *  defaultReturnValue = 0 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
const unsigned char * Kompex::SQLiteStatement::GetSqlResultCString ( const std::string &  sql,
const unsigned char *  defaultReturnValue = 0 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
const unsigned char * Kompex::SQLiteStatement::GetSqlResultCString ( const char *  sql,
const unsigned char *  defaultReturnValue = 0 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
const unsigned char * Kompex::SQLiteStatement::GetSqlResultCString ( const wchar_t *  sql,
const unsigned char *  defaultReturnValue = 0 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
double Kompex::SQLiteStatement::GetSqlResultDouble ( const std::string &  sql,
double  defaultReturnValue = -1 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
double Kompex::SQLiteStatement::GetSqlResultDouble ( const wchar_t *  sql,
double  defaultReturnValue = -1 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
double Kompex::SQLiteStatement::GetSqlResultDouble ( const char *  sql,
double  defaultReturnValue = -1 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
int Kompex::SQLiteStatement::GetSqlResultInt ( const char *  sql,
int  defaultReturnValue = -1 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
int Kompex::SQLiteStatement::GetSqlResultInt ( const std::string &  sql,
int  defaultReturnValue = -1 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
int Kompex::SQLiteStatement::GetSqlResultInt ( const wchar_t *  sql,
int  defaultReturnValue = -1 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
int64 Kompex::SQLiteStatement::GetSqlResultInt64 ( const wchar_t *  sql,
int64  defaultReturnValue = -1 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
int64 Kompex::SQLiteStatement::GetSqlResultInt64 ( const char *  sql,
int64  defaultReturnValue = -1 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
int64 Kompex::SQLiteStatement::GetSqlResultInt64 ( const std::string &  sql,
int64  defaultReturnValue = -1 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
std::string Kompex::SQLiteStatement::GetSqlResultString ( const char *  sql,
const std::string &  defaultReturnValue = "" 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
std::string Kompex::SQLiteStatement::GetSqlResultString ( const wchar_t *  sql,
const std::string &  defaultReturnValue = "" 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
std::string Kompex::SQLiteStatement::GetSqlResultString ( const std::string &  sql,
const std::string &  defaultReturnValue = "" 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
wchar_t * Kompex::SQLiteStatement::GetSqlResultString16 ( const char *  sql,
wchar_t *  defaultReturnValue = 0 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
wchar_t * Kompex::SQLiteStatement::GetSqlResultString16 ( const wchar_t *  sql,
wchar_t *  defaultReturnValue = 0 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
wchar_t * Kompex::SQLiteStatement::GetSqlResultString16 ( const std::string &  sql,
wchar_t *  defaultReturnValue = 0 
)

Executes a SQL statement and returns instantly the result value of the first column from the first row.

Parameters:
sqlSQL statement
defaultReturnValueDefault return value when the SQL statement has no result
void Kompex::SQLiteStatement::GetTable ( const std::string &  sql,
unsigned short  consoleOutputColumnWidth = 20 
) const

Returns the result as a complete table.
Note: only for console (textoutput)
Output: std::cout

Parameters:
sqlSQL query string
consoleOutputColumnWidthWidth of the output column within the console
void Kompex::SQLiteStatement::GetTableColumnMetadata ( const std::string &  tableName,
const std::string &  columnName 
) const

Returns metadata about a specific column of a specific database table. Note: only console output
Output: std::cout

Parameters:
tableNameTable in which the column is found
columnNameColumn for which we want the metadata
void Kompex::SQLiteStatement::Prepare ( const char *  sqlStatement ) [protected]

Compile sql query into a byte-code program.

Parameters:
sqlStatementSQL statement (UTF-8)
void Kompex::SQLiteStatement::Prepare ( const wchar_t *  sqlStatement ) [protected]

Compile sql query into a byte-code program.

Parameters:
sqlStatementSQL statement (UTF-16)
void Kompex::SQLiteStatement::Reset (  ) const

Reset() is called to reset a prepared statement object back to its initial state,
ready to be re-executed. Any SQL statement variables that had values bound to them
using the Bind*() functions retain their values. Use ClearBindings() to reset the bindings.

void Kompex::SQLiteStatement::RollbackTransaction (  ) [inline]

Rollback a transaction.

void Kompex::SQLiteStatement::SecureTransaction ( const char *  sql )

Can be used only for transaction SQL statements.
Can be used for transactions, if you want use the default error handling.
The SecureTransaction() method creates a internal copy of the given sql statement string,
so that you do not run into danger if the string will be invalid due to deletion or local scope.

Parameters:
sqlSQL statement
void Kompex::SQLiteStatement::SecureTransaction ( const std::string  sql )

Can be used only for transaction SQL statements.
Can be used for transactions, if you want use the default error handling.
The SecureTransaction() method creates a internal copy of the given sql statement string,
so that you do not run into danger if the string will be invalid due to deletion or local scope.

Parameters:
sqlSQL statement
void Kompex::SQLiteStatement::SecureTransaction ( const wchar_t *  sql )

Can be used only for transaction SQL statements.
Can be used for transactions, if you want use the default error handling.
The SecureTransaction() method creates a internal copy of the given sql statement string,
so that you do not run into danger if the string will be invalid due to deletion or local scope.

Parameters:
sqlSQL statement
void Kompex::SQLiteStatement::Sql ( const char *  sql ) [inline]

Only for SQL queries/statements which have a result.
e.g. SELECT's or INSERT's which use Bind..() methods! Do not forget to call FreeQuery() when you have finished.

void Kompex::SQLiteStatement::Sql ( const std::string &  sql ) [inline]

Only for SQL queries/statements which have a result.
e.g. SELECT's or INSERT's which use Bind..() methods! Do not forget to call FreeQuery() when you have finished.

void Kompex::SQLiteStatement::Sql ( const wchar_t *  sql ) [inline]

Only for SQL queries/statements which have a result.
e.g. SELECT's or INSERT's which use Bind..() methods! Do not forget to call FreeQuery() when you have finished.

float Kompex::SQLiteStatement::SqlAggregateFuncResult ( wchar_t *  countSql )

Can be used for all SQLite aggregate functions. Here you can see all available aggregate functions: http://sqlite.org/lang_aggfunc.html

Parameters:
countSqlComplete SQL query string (UTF-16).
float Kompex::SQLiteStatement::SqlAggregateFuncResult ( const std::string &  countSql )

Can be used for all SQLite aggregate functions. Here you can see all available aggregate functions: http://sqlite.org/lang_aggfunc.html

Parameters:
countSqlComplete SQL query string (UTF-16).
float Kompex::SQLiteStatement::SqlAggregateFuncResult ( const char *  countSql )

Can be used for all SQLite aggregate functions. Here you can see all available aggregate functions: http://sqlite.org/lang_aggfunc.html

Parameters:
countSqlComplete SQL query string (UTF-16).
void Kompex::SQLiteStatement::SqlStatement ( const wchar_t *  sqlStatement )

Only for SQL statements, which have no result. Can be used for transactions; if you want, you can use an own error handling.

Parameters:
sqlStatementSQL statement (UTF-16)
void Kompex::SQLiteStatement::SqlStatement ( const std::string &  sqlStatement )

Only for SQL statements, which have no result. Can be used for transactions; if you want, you can use an own error handling.

Parameters:
sqlStatementSQL statement (UTF-8)
void Kompex::SQLiteStatement::SqlStatement ( const char *  sqlStatement )

Only for SQL statements, which have no result. Can be used for transactions; if you want, you can use an own error handling.

Parameters:
sqlStatementSQL statement (UTF-8)
bool Kompex::SQLiteStatement::Step (  ) const [protected]

Must be called one or more times to evaluate the statement.

void Kompex::SQLiteStatement::Transaction ( const char *  sql ) [inline]

Can be used only for transaction SQL statements.
Can be used for transactions, if you want use the default error handling. Please note that there is only used a reference of your sql statement.
If your sql statement variable is invalid before you called CommitTransaction() you need to use SecureTransaction(), which creates a internal copy of your sql statement.

Parameters:
sqlSQL statement
void Kompex::SQLiteStatement::Transaction ( const std::string &  sql ) [inline]

Can be used only for transaction SQL statements.
Can be used for transactions, if you want use the default error handling. Please note that there is only used a reference of your sql statement.
If your sql statement variable is invalid before you called CommitTransaction() you need to use SecureTransaction(), which creates a internal copy of your sql statement.

Parameters:
sqlSQL statement
void Kompex::SQLiteStatement::Transaction ( const wchar_t *  sql ) [inline]

Can be used only for transaction SQL statements.
Can be used for transactions, if you want use the default error handling. Please note that there is only used a reference of your sql statement.
If your sql statement variable is invalid before you called CommitTransaction() you need to use SecureTransaction(), which creates a internal copy of your sql statement.

Parameters:
sqlSQL statement

Member Data Documentation

Database pointer.

struct sqlite3_stmt* Kompex::SQLiteStatement::mStatement [private]

SQL statement.

unsigned short Kompex::SQLiteStatement::mTransactionID [private]

id for transactions

Stores UTF-8 transaction statements.

Stores UTF-16 transaction statements.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Defines