wxSqlite3: wxSQLite3

  • Main Page
  • Classes
  • Files

wxSQLite3

What is wxSQLite3?

wxSQLite3 is a C++ wrapper around the public domain SQLite 3.x database and is specifically designed for use in programs based on the wxWidgets library.

Several solutions already exist to access SQLite databases. To name just a few:

  • wxSQLite : This is a wxWidgets wrapper for version 2.8.x of SQLite. Current version of SQLite is 3.3.6 having a lot more features - which are not supported by this wrapper.

  • CppSQLite : Not wxWidgets specific, but with (partial) support for the newer version 3.x of SQLite.

  • databaselayer : This is a database abstraction and supports SQLite and Firebird databases. It's a wrapper around CppSQLite for SQLite resp. IBPP for Firebird.

The component wxSQLite3 was inspired by all three mentioned SQLite wrappers. wxSQLite3 does not try to hide the underlying database, in contrary almost all special features of the SQLite3 version 3.3.4 are supported, like for example the creation of user defined scalar or aggregate functions.

Since SQLite stores strings in UTF-8 encoding, the wxSQLite3 methods provide automatic conversion between wxStrings and UTF-8 strings. This works best for the Unicode builds of wxWidgets. The feature is not fully tested for ANSI builds.

Version history

1.5.3 - June 2006
Upgrade to SQLite version 3.3.6
Added support for optional SQLite meta data methods
1.5.2 - March 2006
Fixed a bug in wxSQLite3Database::Prepare
Added wxSQLite3Database::IsOpen for convenience
1.5.1 - February 2006
Upgrade to SQLite version 3.3.4 (wxMSW only)
1.5 - February 2006
Upgrade to SQLite version 3.3.3
Added support for commit, rollback and update callbacks

1.4.2 - November 2005
Optimized code for wxString arguments

1.4.1 - November 2005
Fixed a bug in wxSQLite3Database::TableExists,
Changed the handling of Unicode string conversion,
Added support for different transaction types

1.4 - November 2005
Optionally load the SQLite library dynamically at run time.

1.3.1 - November 2005
Corrected wxSQLite3ResultSet::GetInt64.
Added wxSQLite3Table::GetInt64

1.3 - October 2005
Added wxGTK build support

1.2 - October 2005
Corrected error in wxSQLite3Table::FindColumnIndex

1.1 - October 2005
Upgrade to SQLite version 3.2.7

1.0 - July 2005
First public release

Author:
Ulrich Telle (ulrich DOT telle AT gmx DOT de)
Generated on Fri Aug 4 12:22:56 2006 for wxSqlite3 by doxygen 1.4.6-NO


wxSqlite3: Class List

  • Class List
  • Class Hierarchy
  • Class Members

wxSqlite3 Class List

Here are the classes, structs, unions and interfaces with brief descriptions:
wxSQLite3AggregateFunction | Interface for user defined aggregate functions
wxSQLite3Authorizer | Interface for a user defined authorizer function
wxSQLite3Database | Represents a SQLite3 database object
wxSQLite3Exception | SQL exception
wxSQLite3FunctionContext | Context for user defined scalar or aggregate functions
wxSQLite3Hook | Interface for a user defined hook function
wxSQLite3ResultSet | Result set of a SQL query
wxSQLite3ScalarFunction | Interface for user defined scalar functions
wxSQLite3Statement | Represents a prepared SQL statement
wxSQLite3StatementBuffer | SQL statment buffer for use with SQLite3's printf method
wxSQLite3Table | Holds the complete result set of a SQL query
Generated on Fri Aug 4 12:22:57 2006 for wxSqlite3 by doxygen 1.4.6-NO


wxSqlite3: wxSQLite3AggregateFunction Class Reference

wxSQLite3AggregateFunction Class Reference

Interface for user defined aggregate functions. More...

#include <wxsqlite3.h>

List of all members.

Public Member Functions

virtual | ~wxSQLite3AggregateFunction ()
Virtual destructor.
virtual void | Aggregate (wxSQLite3FunctionContext &ctx)=0
Execute the aggregate of the function.
virtual void | Finalize (wxSQLite3FunctionContext &ctx)=0
Prepare the result of the aggregate function.

Detailed Description

Interface for user defined aggregate functions.

Definition at line 320 of file wxsqlite3.h.

Member Function Documentation

virtual void wxSQLite3AggregateFunction::Aggregate ( wxSQLite3FunctionContext & ctx ) [pure virtual]

Execute the aggregate of the function.

This method is invoked for each row of the result set of the query using the aggregate function.

Parameters:
ctx function context which can be used to access arguments and result value

Referenced by wxSQLite3FunctionContext::ExecAggregateStep().

virtual void wxSQLite3AggregateFunction::Finalize ( wxSQLite3FunctionContext & ctx ) [pure virtual]

Prepare the result of the aggregate function.

This method is invoked after all rows of the result set of the query using the aggregate function have been processed. Usually the final result is calculated and returned in this method.

Parameters:
ctx function context which can be used to access arguments and result value

Referenced by wxSQLite3FunctionContext::ExecAggregateFinalize().

The documentation for this class was generated from the following file:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h


wxSqlite3: Member List

wxSQLite3AggregateFunction Member List

This is the complete list of members for wxSQLite3AggregateFunction, including all inherited members.

Aggregate(wxSQLite3FunctionContext &ctx)=0 | wxSQLite3AggregateFunction | [pure virtual]
Finalize(wxSQLite3FunctionContext &ctx)=0 | wxSQLite3AggregateFunction | [pure virtual]
~wxSQLite3AggregateFunction() | wxSQLite3AggregateFunction | [inline, virtual]


wxSqlite3: wxSQLite3Authorizer Class Reference

wxSQLite3Authorizer Class Reference

Interface for a user defined authorizer function. More...

#include <wxsqlite3.h>

List of all members.

Public Types

enum | wxAuthorizationCode
Codes identifying the command for which authorization is requested.
enum | wxAuthorizationResult
Return codes of the authorizer.

Public Member Functions

virtual | ~wxSQLite3Authorizer ()
Virtual destructor.
virtual wxAuthorizationResult | Authorize (wxAuthorizationCode type, const wxString &arg1, const wxString &arg2, const wxString &arg3, const wxString &arg4)=0
Execute the authorizer function.

Static Public Member Functions

static wxString | AuthorizationCodeToString (wxSQLite3Authorizer::wxAuthorizationCode type)
Convert authorization code to string.

Detailed Description

Interface for a user defined authorizer function.

Definition at line 346 of file wxsqlite3.h.

Member Function Documentation

wxString wxSQLite3Authorizer::AuthorizationCodeToString ( wxSQLite3Authorizer::wxAuthorizationCode type ) [static]

Convert authorization code to string.

Parameters:
type wxAuthorizationCode. The value signifies what kind of operation is to be authorized.

Definition at line 2107 of file wxsqlite3.cpp.

virtual wxAuthorizationResult wxSQLite3Authorizer::Authorize | ( | wxAuthorizationCode | type,
 |  | const wxString & | arg1,
 |  | const wxString & | arg2,
 |  | const wxString & | arg3,
 |  | const wxString & | arg4
 | ) | [pure virtual]

Execute the authorizer function.

Please refer to the SQLite documentation for further information about the meaning of the parameters.

Parameters:
type | wxAuthorizationCode. The value signifies what kind of operation is to be authorized.
arg1 | first argument (value depends on "type")
arg2 | second argument (value depends on "type")
arg3 | third argument (name of database if applicable)
arg4 | fourth argument (name of trigger or view if applicable)
Returns:
a wxAuthorizationResult, i.e. SQLITE_OK, SQLITE_DENY or SQLITE_IGNORE

The documentation for this class was generated from the following files:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp


wxSqlite3: Member List

wxSQLite3Authorizer Member List

This is the complete list of members for wxSQLite3Authorizer, including all inherited members.

AuthorizationCodeToString(wxSQLite3Authorizer::wxAuthorizationCode type) | wxSQLite3Authorizer | [static]
Authorize(wxAuthorizationCode type, const wxString &arg1, const wxString &arg2, const wxString &arg3, const wxString &arg4)=0 | wxSQLite3Authorizer | [pure virtual]
wxAuthorizationCode enum name | wxSQLite3Authorizer |
wxAuthorizationResult enum name | wxSQLite3Authorizer |
~wxSQLite3Authorizer() | wxSQLite3Authorizer | [inline, virtual]


wxSqlite3: wxSQLite3Database Class Reference

wxSQLite3Database Class Reference

Represents a SQLite3 database object. More...

#include <wxsqlite3.h>

List of all members.

Public Member Functions

wxSQLite3Database ()
Default constructor.
virtual | ~wxSQLite3Database ()
Destructor.
void | Open (const wxString &fileName)
Open a SQLite3 database.
bool | IsOpen ()
Check whether the database has been opened.
void | Close ()
Close a SQLite3 database.
void | Begin (wxSQLite3TransactionType transactionType=WXSQLITE_TRANSACTION_DEFAULT)
Begin transaction.
void | Commit ()
Commit transaction.
void | Rollback ()
Rollback transaction.
bool | GetAutoCommit ()
Get the auto commit state.
bool | TableExists (const wxString &tableName)
Check whether a table with the given name exists.
bool | CheckSyntax (const wxString &sql)
Check the syntax of an SQL statement given as a wxString.
bool | CheckSyntax (const wxSQLite3StatementBuffer &sql)
Check the syntax of an SQL statement given as a statement buffer.
bool | CheckSyntax (const char *sql)
Check the syntax of an SQL statement given as a utf-8 character string.
int | ExecuteUpdate (const wxString &sql)
Execute a insert, update or delete SQL statement given as a wxString.
int | ExecuteUpdate (const wxSQLite3StatementBuffer &sql)
Execute a insert, update or delete SQL statement given as a statement buffer.
int | ExecuteUpdate (const char *sql)
Execute a insert, update or delete SQL statement given as a utf-8 character string.
wxSQLite3ResultSet | ExecuteQuery (const wxString &sql)
Execute a SQL query statement given as a wxString.
wxSQLite3ResultSet | ExecuteQuery (const wxSQLite3StatementBuffer &sql)
Execute a SQL query statement given as a statement buffer.
wxSQLite3ResultSet | ExecuteQuery (const char *sql)
Execute a SQL query statement given as a utf-8 character string.
int | ExecuteScalar (const wxString &sql)
Execute a scalar SQL query statement given as a wxString.
int | ExecuteScalar (const wxSQLite3StatementBuffer &sql)
Execute a scalar SQL query statement given as a statement buffer.
int | ExecuteScalar (const char *sql)
Execute a scalar SQL query statement given as a utf-8 character string.
wxSQLite3Table | GetTable (const wxString &sql)
Get the result table for a SQL query statement given as a wxString.
wxSQLite3Table | GetTable (const wxSQLite3StatementBuffer &sql)
Get the result table for a SQL query statement given as a statement buffer.
wxSQLite3Table | GetTable (const char *sql)
Get the result table for a SQL query statement given as a utf-8 character string.
wxSQLite3Statement | PrepareStatement (const wxString &sql)
Prepare a SQL query statement given as a wxString for parameter binding.
wxSQLite3Statement | PrepareStatement (const wxSQLite3StatementBuffer &sql)
Prepare a SQL query statement given as a statement buffer for parameter binding.
wxSQLite3Statement | PrepareStatement (const char *sql)
Prepare a SQL query statement given as a utf-8 character string for parameter binding.
wxLongLong | GetLastRowId ()
Get the row id of last inserted row.
void | Interrupt ()
Interrupt a long running query.
void | SetBusyTimeout (int milliSeconds)
Set the busy timeout.
bool | CreateFunction (const wxString &name, int argCount, wxSQLite3ScalarFunction &function)
Create a user-defined scalar function.
bool | CreateFunction (const wxString &name, int argCount, wxSQLite3AggregateFunction &function)
Create a user-defined aggregate function.
bool | SetAuthorizer (wxSQLite3Authorizer &authorizer)
Create a user-defined authorizer function.
void | SetCommitHook (wxSQLite3Hook *commitHook)
Create a user-defined commit callback function.
void | SetRollbackHook (wxSQLite3Hook *rollbackHook)
Create a user-defined rollback callback function.
void | SetUpdateHook (wxSQLite3Hook *updateHook)
Create a user-defined update callback function.

Static Public Member Functions

static wxString | GetVersion ()
Get the version of the underlying SQLite3 library.

Detailed Description

Represents a SQLite3 database object.

Definition at line 1144 of file wxsqlite3.h.

Constructor & Destructor Documentation

wxSQLite3Database::wxSQLite3Database ( )

Default constructor.

Initializes a SQLite database object. The SQLite database object can only be used in the same thread in which it was created.

Definition at line 1398 of file wxsqlite3.cpp.

wxSQLite3Database::~wxSQLite3Database ( ) [virtual]

Destructor.

Destructs a SQLite database object. The database will be closed implicitly if it is still open.

Definition at line 1410 of file wxsqlite3.cpp.

References Close().

Member Function Documentation

void wxSQLite3Database::Begin ( wxSQLite3TransactionType transactionType = WXSQLITE_TRANSACTION_DEFAULT )

Begin transaction.

In SQLite transactions can be deferred, immediate, or exclusive. Deferred means that no locks are acquired on the database until the database is first accessed. Thus with a deferred transaction, the BEGIN statement itself does nothing. Locks are not acquired until the first read or write operation. The first read operation against a database creates a SHARED lock and the first write operation creates a RESERVED lock. Because the acquisition of locks is deferred until they are needed, it is possible that another thread or process could create a separate transaction and write to the database after the BEGIN on the current thread has executed. If the transaction is immediate, then RESERVED locks are acquired on all databases as soon as the BEGIN command is executed, without waiting for the database to be used. After a BEGIN IMMEDIATE, it is guaranteed that no other thread or process will be able to write to the database or do a BEGIN IMMEDIATE or BEGIN EXCLUSIVE. Other processes can continue to read from the database, however. An exclusive transaction causes EXCLUSIVE locks to be acquired on all databases. After a BEGIN EXCLUSIVE, it is guaranteed that no other thread or process will be able to read or write the database until the transaction is complete.

Parameters:
[in] transactionType type of transaction (default: DEFERRED).

Definition at line 1452 of file wxsqlite3.cpp.

References ExecuteUpdate().

bool wxSQLite3Database::CheckSyntax ( const char * sql )

Check the syntax of an SQL statement given as a utf-8 character string.

Parameters:
sql query string
Returns:
TRUE if the syntax is correct, FALSE otherwise

Definition at line 1528 of file wxsqlite3.cpp.

bool wxSQLite3Database::CheckSyntax ( const wxSQLite3StatementBuffer & sql )

Check the syntax of an SQL statement given as a statement buffer.

Parameters:
sql query string
Returns:
TRUE if the syntax is correct, FALSE otherwise

Definition at line 1523 of file wxsqlite3.cpp.

References CheckSyntax().

bool wxSQLite3Database::CheckSyntax ( const wxString & sql )

Check the syntax of an SQL statement given as a wxString.

Parameters:
sql query string
Returns:
TRUE if the syntax is correct, FALSE otherwise

Definition at line 1516 of file wxsqlite3.cpp.

Referenced by CheckSyntax().

void wxSQLite3Database::Close ( )

Close a SQLite3 database.

Take care that all prepared statements have been finalized!

Definition at line 1443 of file wxsqlite3.cpp.

Referenced by ~wxSQLite3Database().

bool wxSQLite3Database::CreateFunction | ( | const wxString & | name,
 |  | int | argCount,
 |  | wxSQLite3AggregateFunction & | function
 | ) |

Create a user-defined aggregate function.

Registers a SQL aggregate function with the database.

Parameters:
name
argCount | number of arguments the aggregate function takes. If this argument is -1 then the aggregate function may take any number of arguments.
function | instance of an aggregate function
Returns:
TRUE on successful registration, FALSE otherwise

Definition at line 1691 of file wxsqlite3.cpp.

References wxSQLite3FunctionContext::ExecAggregateFinalize(), and wxSQLite3FunctionContext::ExecAggregateStep().

bool wxSQLite3Database::CreateFunction | ( | const wxString & | name,
 |  | int | argCount,
 |  | wxSQLite3ScalarFunction & | function
 | ) |

Create a user-defined scalar function.

Registers a SQL scalar function with the database.

Parameters:
name
argCount | number of arguments the scalar function takes. If this argument is -1 then the scalar function may take any number of arguments.
function | instance of an scalar function
Returns:
TRUE on successful registration, FALSE otherwise

Definition at line 1680 of file wxsqlite3.cpp.

References wxSQLite3FunctionContext::ExecScalarFunction().

wxSQLite3ResultSet wxSQLite3Database::ExecuteQuery ( const char * sql )

Execute a SQL query statement given as a utf-8 character string.

Parameters:
sql query string
Returns:
result set instance

Definition at line 1575 of file wxsqlite3.cpp.

References UTF8toWxString().

wxSQLite3ResultSet wxSQLite3Database::ExecuteQuery ( const wxSQLite3StatementBuffer & sql )

Execute a SQL query statement given as a statement buffer.

Parameters:
sql query string
Returns:
result set instance

Definition at line 1570 of file wxsqlite3.cpp.

References ExecuteQuery().

wxSQLite3ResultSet wxSQLite3Database::ExecuteQuery ( const wxString & sql )

Execute a SQL query statement given as a wxString.

Parameters:
sql query string
Returns:
result set instance

Definition at line 1563 of file wxsqlite3.cpp.

Referenced by ExecuteQuery(), and ExecuteScalar().

int wxSQLite3Database::ExecuteScalar ( const char * sql )

Execute a scalar SQL query statement given as a utf-8 character string.

Allows to easily retrieve the result of queries returning a single integer result like SELECT COUNT(*) FROM table WHERE condition.

Parameters:
sql query string
Returns:
first column of first row as an int

Definition at line 1611 of file wxsqlite3.cpp.

References wxSQLite3ResultSet::Eof(), ExecuteQuery(), wxSQLite3ResultSet::GetColumnCount(), wxERRMSG_INVALID_QUERY, and WXSQLITE_ERROR.

int wxSQLite3Database::ExecuteScalar ( const wxSQLite3StatementBuffer & sql )

Execute a scalar SQL query statement given as a statement buffer.

Allows to easily retrieve the result of queries returning a single integer result like SELECT COUNT(*) FROM table WHERE condition.

Parameters:
sql query string
Returns:
first column of first row as an int

Definition at line 1606 of file wxsqlite3.cpp.

References ExecuteScalar().

int wxSQLite3Database::ExecuteScalar ( const wxString & sql )

Execute a scalar SQL query statement given as a wxString.

Allows to easily retrieve the result of queries returning a single integer result like SELECT COUNT(*) FROM table WHERE condition.

Parameters:
sql query string
Returns:
first column of first row as an int

Definition at line 1599 of file wxsqlite3.cpp.

Referenced by ExecuteScalar(), and TableExists().

int wxSQLite3Database::ExecuteUpdate ( const char * sql )

Execute a insert, update or delete SQL statement given as a utf-8 character string.

Parameters:
sql query string
Returns:
the number of database rows that were changed (or inserted or deleted)

Definition at line 1545 of file wxsqlite3.cpp.

References UTF8toWxString().

int wxSQLite3Database::ExecuteUpdate ( const wxSQLite3StatementBuffer & sql )

Execute a insert, update or delete SQL statement given as a statement buffer.

Parameters:
sql query string
Returns:
the number of database rows that were changed (or inserted or deleted)

Definition at line 1540 of file wxsqlite3.cpp.

References ExecuteUpdate().

int wxSQLite3Database::ExecuteUpdate ( const wxString & sql )

Execute a insert, update or delete SQL statement given as a wxString.

Parameters:
sql query string
Returns:
the number of database rows that were changed (or inserted or deleted)

Definition at line 1533 of file wxsqlite3.cpp.

Referenced by Begin(), Commit(), ExecuteUpdate(), and Rollback().

bool wxSQLite3Database::GetAutoCommit ( )

Get the auto commit state.

Test to see whether or not the database connection is in autocommit mode.

Returns:
TRUE if it is and FALSE if not. Autocommit mode is on by default. Autocommit is disabled by a BEGIN statement and reenabled by the next COMMIT or ROLLBACK.

Definition at line 1483 of file wxsqlite3.cpp.

wxLongLong wxSQLite3Database::GetLastRowId ( )

Get the row id of last inserted row.

Each entry in an SQLite table has a unique integer key. (The key is the value of the INTEGER PRIMARY KEY column if there is such a column, otherwise the key is generated at random. The unique key is always available as the ROWID, OID, or _ROWID_ column.)

Returns:
the integer key of the most recent insert in the database.

Definition at line 1659 of file wxsqlite3.cpp.

wxSQLite3Table wxSQLite3Database::GetTable ( const char * sql )

Get the result table for a SQL query statement given as a utf-8 character string.

Returns all resulting rows of the query for later processing.

Parameters:
sql query string
Returns:
table instance

Definition at line 1637 of file wxsqlite3.cpp.

References UTF8toWxString().

wxSQLite3Table wxSQLite3Database::GetTable ( const wxSQLite3StatementBuffer & sql )

Get the result table for a SQL query statement given as a statement buffer.

Returns all resulting rows of the query for later processing.

Parameters:
sql query string
Returns:
table instance

Definition at line 1632 of file wxsqlite3.cpp.

References GetTable().

wxSQLite3Table wxSQLite3Database::GetTable ( const wxString & sql )

Get the result table for a SQL query statement given as a wxString.

Returns all resulting rows of the query for later processing.

Parameters:
sql query string
Returns:
table instance

Definition at line 1625 of file wxsqlite3.cpp.

Referenced by GetTable().

wxString wxSQLite3Database::GetVersion ( ) [static]

Get the version of the underlying SQLite3 library.

Returns:
a string which contains the version number of the library

Definition at line 1675 of file wxsqlite3.cpp.

References UTF8toWxString().

void wxSQLite3Database::Interrupt ( )

Interrupt a long running query.

Causes any pending database operation to abort and return at its earliest opportunity. This method 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.

Definition at line 1664 of file wxsqlite3.cpp.

bool wxSQLite3Database::IsOpen ( )

Check whether the database has been opened.

Returns:
TRUE if database has been opened, FALSE otherwise

Definition at line 1438 of file wxsqlite3.cpp.

void wxSQLite3Database::Open ( const wxString & fileName )

Open a SQLite3 database.

Opens the sqlite database file "filename". The "filename" is UTF-8 encoded. If the database could not be opened (or created) successfully, then an exception is thrown. If the database file does not exist, then a new database will be created as needed.

Parameters:
[in] fileName Name of the database file.

Definition at line 1422 of file wxsqlite3.cpp.

References SetBusyTimeout(), and UTF8toWxString().

wxSQLite3Statement wxSQLite3Database::PrepareStatement ( const char * sql )

Prepare a SQL query statement given as a utf-8 character string for parameter binding.

Parameters:
sql query string
Returns:
statement instance

Definition at line 1501 of file wxsqlite3.cpp.

wxSQLite3Statement wxSQLite3Database::PrepareStatement ( const wxSQLite3StatementBuffer & sql )

Prepare a SQL query statement given as a statement buffer for parameter binding.

Parameters:
sql query string
Returns:
statement instance

Definition at line 1496 of file wxsqlite3.cpp.

References PrepareStatement().

wxSQLite3Statement wxSQLite3Database::PrepareStatement ( const wxString & sql )

Prepare a SQL query statement given as a wxString for parameter binding.

Parameters:
sql query string
Returns:
statement instance

Definition at line 1489 of file wxsqlite3.cpp.

Referenced by PrepareStatement().

bool wxSQLite3Database::SetAuthorizer ( wxSQLite3Authorizer & authorizer )

Create a user-defined authorizer function.

Registers an authorizer object with the SQLite library. The authorizer is invoked (at compile-time, not at run-time) for each attempt to access a column of a table in the database. The authorizer should return SQLITE_OK if access is allowed, SQLITE_DENY if the entire SQL statement should be aborted with an error and SQLITE_IGNORE if the column should be treated as a NULL value.

Parameters:
authorizer instance of an authorizer function
Returns:
TRUE on successful registration, FALSE otherwise

Definition at line 1704 of file wxsqlite3.cpp.

References wxSQLite3FunctionContext::ExecAuthorizer().

void wxSQLite3Database::SetBusyTimeout ( int milliSeconds )

Set the busy timeout.

This method sets a busy handler that sleeps for a while when a table is locked. The handler will sleep multiple times until at least "ms" milliseconds of sleeping have been done. Calling this routine with an argument less than or equal to zero turns off all busy handlers.

Parameters:
milliSeconds timeout in milliseconds

Definition at line 1669 of file wxsqlite3.cpp.

Referenced by Open().

void wxSQLite3Database::SetCommitHook ( wxSQLite3Hook * commitHook )

Create a user-defined commit callback function.

Registers a callback function object to be invoked whenever a new transaction is committed. If the callback function returns non-zero, then the commit is converted into a rollback. Registering a NULL function object disables the callback. Only a single commit hook callback can be registered at a time.

Parameters:
commitHook address of an instance of a commit callback function

Definition at line 1711 of file wxsqlite3.cpp.

References wxSQLite3FunctionContext::ExecCommitHook().

void wxSQLite3Database::SetRollbackHook ( wxSQLite3Hook * rollbackHook )

Create a user-defined rollback callback function.

Registers a callback function object to be invoked whenever a transaction is rolled back. Registering a NULL function object disables the callback. Only a single rollback hook callback can be registered at a time.

For the purposes of this API, a transaction is said to have been rolled back if an explicit "ROLLBACK" statement is executed, or an error or constraint causes an implicit rollback to occur. The callback is not invoked if a transaction is automatically rolled back because the database connection is closed.

Parameters:
rollbackHook address of an instance of a rollback callback function

Definition at line 1724 of file wxsqlite3.cpp.

References wxSQLite3FunctionContext::ExecRollbackHook().

void wxSQLite3Database::SetUpdateHook ( wxSQLite3Hook * updateHook )

Create a user-defined update callback function.

Registers a callback function object to be invoked whenever a row is updated, inserted or deleted. Registering a NULL function object disables the callback. Only a single commit hook callback can be registered at a time. The update hook is not invoked when internal system tables are modified (i.e. sqlite_master and sqlite_sequence).

Parameters:
updateHook address of an instance of an update callback function

Definition at line 1737 of file wxsqlite3.cpp.

References wxSQLite3FunctionContext::ExecUpdateHook().

bool wxSQLite3Database::TableExists ( const wxString & tableName )

Check whether a table with the given name exists.

Parameters:
tableName name of the table
Returns:
TRUE if the table exists, FALSE otherwise

Definition at line 1508 of file wxsqlite3.cpp.

References ExecuteScalar().

The documentation for this class was generated from the following files:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp


wxSqlite3: Member List

wxSQLite3Database Member List

This is the complete list of members for wxSQLite3Database, including all inherited members.

Begin(wxSQLite3TransactionType transactionType=WXSQLITE_TRANSACTION_DEFAULT) | wxSQLite3Database |
CheckSyntax(const wxString &sql) | wxSQLite3Database |
CheckSyntax(const wxSQLite3StatementBuffer &sql) | wxSQLite3Database |
CheckSyntax(const char *sql) | wxSQLite3Database |
Close() | wxSQLite3Database |
Commit() | wxSQLite3Database |
CreateFunction(const wxString &name, int argCount, wxSQLite3ScalarFunction &function) | wxSQLite3Database |
CreateFunction(const wxString &name, int argCount, wxSQLite3AggregateFunction &function) | wxSQLite3Database |
ExecuteQuery(const wxString &sql) | wxSQLite3Database |
ExecuteQuery(const wxSQLite3StatementBuffer &sql) | wxSQLite3Database |
ExecuteQuery(const char *sql) | wxSQLite3Database |
ExecuteScalar(const wxString &sql) | wxSQLite3Database |
ExecuteScalar(const wxSQLite3StatementBuffer &sql) | wxSQLite3Database |
ExecuteScalar(const char *sql) | wxSQLite3Database |
ExecuteUpdate(const wxString &sql) | wxSQLite3Database |
ExecuteUpdate(const wxSQLite3StatementBuffer &sql) | wxSQLite3Database |
ExecuteUpdate(const char *sql) | wxSQLite3Database |
GetAutoCommit() | wxSQLite3Database |
GetLastRowId() | wxSQLite3Database |
GetTable(const wxString &sql) | wxSQLite3Database |
GetTable(const wxSQLite3StatementBuffer &sql) | wxSQLite3Database |
GetTable(const char *sql) | wxSQLite3Database |
GetVersion() | wxSQLite3Database | [static]
Interrupt() | wxSQLite3Database |
IsOpen() | wxSQLite3Database |
Open(const wxString &fileName) | wxSQLite3Database |
PrepareStatement(const wxString &sql) | wxSQLite3Database |
PrepareStatement(const wxSQLite3StatementBuffer &sql) | wxSQLite3Database |
PrepareStatement(const char *sql) | wxSQLite3Database |
Rollback() | wxSQLite3Database |
SetAuthorizer(wxSQLite3Authorizer &authorizer) | wxSQLite3Database |
SetBusyTimeout(int milliSeconds) | wxSQLite3Database |
SetCommitHook(wxSQLite3Hook *commitHook) | wxSQLite3Database |
SetRollbackHook(wxSQLite3Hook *rollbackHook) | wxSQLite3Database |
SetUpdateHook(wxSQLite3Hook *updateHook) | wxSQLite3Database |
TableExists(const wxString &tableName) | wxSQLite3Database |
wxSQLite3Database() | wxSQLite3Database |
~wxSQLite3Database() | wxSQLite3Database | [virtual]


wxSqlite3: wxSQLite3Exception Class Reference

wxSQLite3Exception Class Reference

SQL exception. More...

#include <wxsqlite3.h>

List of all members.

Public Member Functions

wxSQLite3Exception (int errorCode, const wxString &errMsg)
Constructor.
wxSQLite3Exception (const wxSQLite3Exception &e)
Copy constructor.
virtual | ~wxSQLite3Exception ()
Destructor.
const int | GetErrorCode ()
Get error code associated with the exception.
const wxString | GetMessage ()
Get error message associated with the exception.

Static Public Member Functions

static const wxString | ErrorCodeAsString (int errorCode)
Convert error code to error message.

Detailed Description

SQL exception.

Definition at line 47 of file wxsqlite3.h.

The documentation for this class was generated from the following files:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp


wxSqlite3: Member List

wxSQLite3Exception Member List

This is the complete list of members for wxSQLite3Exception, including all inherited members.

ErrorCodeAsString(int errorCode) | wxSQLite3Exception | [static]
GetErrorCode() | wxSQLite3Exception | [inline]
GetMessage() | wxSQLite3Exception | [inline]
wxSQLite3Exception(int errorCode, const wxString &errMsg) | wxSQLite3Exception |
wxSQLite3Exception(const wxSQLite3Exception &e) | wxSQLite3Exception |
~wxSQLite3Exception() | wxSQLite3Exception | [virtual]


wxSqlite3: wxSQLite3FunctionContext Class Reference

wxSQLite3FunctionContext Class Reference

Context for user defined scalar or aggregate functions. More...

#include <wxsqlite3.h>

List of all members.

Public Member Functions

int | GetArgCount ()
Get the number of function arguments.
int | GetArgType (int argIndex)
Get the type of a function argument.
bool | IsNull (int argIndex)
Check whether a function argument is a NULL value.
int | GetInt (int argIndex, int nullValue=0)
Get a function argument as an integer value.
wxLongLong | GetInt64 (int argIndex, wxLongLong nullValue=0)
Get a function argument as an 64-bit integer value.
double | GetDouble (int argIndex, double nullValue=0)
Get a function argument as a double value.
wxString | GetString (int argIndex, const wxString &nullValue=wxEmptyString)
Get a function argument as a string value.
const unsigned char * | GetBlob (int argIndex, int &len)
Get a function argument as a BLOB value.
void | SetResult (int value)
Set the function result as an integer value.
void | SetResult (wxLongLong value)
Set the function result as an 64-bit integer value.
void | SetResult (double value)
Set the function result as a double value.
void | SetResult (const wxString &value)
Set the function result as a string value.
void | SetResult (unsigned char *value, int len)
Set the function result as a BLOB value.
void | SetResultNull ()
Set the function result as a NULL value.
void | SetResultArg (int argIndex)
Set the function result as a exact copy of a function argument.
void | SetResultError (const wxString &errmsg)
Set an error message as the function result.
int | GetAggregateCount ()
Get the number of aggregate steps.
void * | GetAggregateStruct (int len)
Get a pointer to an aggregate structure of specified length.

Static Public Member Functions

static void | ExecScalarFunction (void *ctx, int argc, void **argv)
Execute a user defined scalar function (internal use only).
static void | ExecAggregateStep (void *ctx, int argc, void **argv)
Execute an aggregate step of a user defined aggregate function (internal use only).
static void | ExecAggregateFinalize (void *ctx)
Execute the final step of a user defined aggregate function (internal use only).
static int | ExecAuthorizer (void *, int type, const char *arg1, const char *arg2, const char *arg3, const char *arg4)
Execute the user defined authorizer function (internal use only).
static int | ExecCommitHook (void *hook)
Execute the user defined commit hook (internal use only).
static void | ExecRollbackHook (void *hook)
Execute the user defined rollback hook (internal use only).
static void | ExecUpdateHook (void *hook, int type, const char *database, const char *table, wxsqlite_int64 rowid)
Execute the user defined update hook (internal use only).

Detailed Description

Context for user defined scalar or aggregate functions.

A function context gives user defined scalar or aggregate functions access to function arguments and function results. The "Execute" method resp. the "Aggregate" and "Finalize" methods receive the current function context as an argument.

Definition at line 133 of file wxsqlite3.h.

Member Function Documentation

int wxSQLite3FunctionContext::GetAggregateCount ( )

Get the number of aggregate steps.

Returns:
the number of aggregation steps. The current aggregation step counts so at least 1 is returned.

Definition at line 1990 of file wxsqlite3.cpp.

void * wxSQLite3FunctionContext::GetAggregateStruct ( int len )

Get a pointer to an aggregate structure of specified length.

Usually an aggregation functions needs temporary memory to collect the information gathered from each invocation of the "Aggregate" method. On the first invocation of this method the returned memory contains binary zeros. If this memory is used to store pointers to allocated objects, it is important to free all allocated objects in the "Finalize" method.

Parameters:
len amount of memory needed in bytes
Returns:
pointer to the allocated memory

Definition at line 2002 of file wxsqlite3.cpp.

int wxSQLite3FunctionContext::GetArgCount ( )

Get the number of function arguments.

Returns:
the number of arguments the function was called with

Definition at line 1816 of file wxsqlite3.cpp.

int wxSQLite3FunctionContext::GetArgType ( int argIndex )

Get the type of a function argument.

Parameters:
argIndex index of the function argument. Indices start with 0.
Returns:
argument type as one of the values WXSQLITE_INTEGER, WXSQLITE_FLOAT, WXSQLITE_TEXT, WXSQLITE_BLOB, or WXSQLITE_NULL

Definition at line 1821 of file wxsqlite3.cpp.

const unsigned char * wxSQLite3FunctionContext::GetBlob | ( | int | argIndex,
 |  | int & | len
 | ) |

Get a function argument as a BLOB value.

Parameters:
argIndex | index of the function argument. Indices start with 0.
[out] | len | length of the blob argument in bytes
Returns:
argument value

Definition at line 1922 of file wxsqlite3.cpp.

References IsNull().

double wxSQLite3FunctionContext::GetDouble | ( | int | argIndex,
 |  | double | nullValue = 0
 | ) |

Get a function argument as a double value.

Parameters:
argIndex | index of the function argument. Indices start with 0.
nullValue | value to be returned in case the argument is NULL
Returns:
argument value

Definition at line 1883 of file wxsqlite3.cpp.

References IsNull().

int wxSQLite3FunctionContext::GetInt | ( | int | argIndex,
 |  | int | nullValue = 0
 | ) |

Get a function argument as an integer value.

Parameters:
argIndex | index of the function argument. Indices start with 0.
nullValue | value to be returned in case the argument is NULL
Returns:
argument value

Definition at line 1845 of file wxsqlite3.cpp.

References IsNull().

wxLongLong wxSQLite3FunctionContext::GetInt64 | ( | int | argIndex,
 |  | wxLongLong | nullValue = 0
 | ) |

Get a function argument as an 64-bit integer value.

Parameters:
argIndex | index of the function argument. Indices start with 0.
nullValue | value to be returned in case the argument is NULL
Returns:
argument value

Definition at line 1864 of file wxsqlite3.cpp.

References IsNull().

wxString wxSQLite3FunctionContext::GetString | ( | int | argIndex,
 |  | const wxString & | nullValue = wxEmptyString
 | ) |

Get a function argument as a string value.

Parameters:
argIndex | index of the function argument. Indices start with 0.
nullValue | value to be returned in case the argument is NULL
Returns:
argument value

Definition at line 1902 of file wxsqlite3.cpp.

References IsNull(), and UTF8toWxString().

bool wxSQLite3FunctionContext::IsNull ( int argIndex )

Check whether a function argument is a NULL value.

Parameters:
argIndex index of the function argument. Indices start with 0.
Returns:
TRUE if the argument is NULL or the argIndex is out of bounds, FALSE otherwise

Definition at line 1833 of file wxsqlite3.cpp.

Referenced by GetBlob(), GetDouble(), GetInt(), GetInt64(), and GetString().

void wxSQLite3FunctionContext::SetResult | ( | unsigned char * | value,
 |  | int | len
 | ) |

Set the function result as a BLOB value.

Parameters:
value | function result value
len | length of the result blob in bytes

Definition at line 1964 of file wxsqlite3.cpp.

void wxSQLite3FunctionContext::SetResult ( const wxString & value )

Set the function result as a string value.

Parameters:
value function result value

Definition at line 1957 of file wxsqlite3.cpp.

void wxSQLite3FunctionContext::SetResult ( double value )

Set the function result as a double value.

Parameters:
value function result value

Definition at line 1952 of file wxsqlite3.cpp.

void wxSQLite3FunctionContext::SetResult ( wxLongLong value )

Set the function result as an 64-bit integer value.

Parameters:
value function result value

Definition at line 1947 of file wxsqlite3.cpp.

void wxSQLite3FunctionContext::SetResult ( int value )

Set the function result as an integer value.

Parameters:
value function result value

Definition at line 1942 of file wxsqlite3.cpp.

void wxSQLite3FunctionContext::SetResultArg ( int argIndex )

Set the function result as a exact copy of a function argument.

Parameters:
argIndex index of the argument which should be copied as the result value

Definition at line 1974 of file wxsqlite3.cpp.

void wxSQLite3FunctionContext::SetResultError ( const wxString & errmsg )

Set an error message as the function result.

Parameters:
errmsg string containing an error message

Definition at line 1983 of file wxsqlite3.cpp.

The documentation for this class was generated from the following files:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp


wxSqlite3: Member List

wxSQLite3FunctionContext Member List

This is the complete list of members for wxSQLite3FunctionContext, including all inherited members.

ExecAggregateFinalize(void *ctx) | wxSQLite3FunctionContext | [static]
ExecAggregateStep(void *ctx, int argc, void **argv) | wxSQLite3FunctionContext | [static]
ExecAuthorizer(void *, int type, const char *arg1, const char *arg2, const char *arg3, const char *arg4) | wxSQLite3FunctionContext | [static]
ExecCommitHook(void *hook) | wxSQLite3FunctionContext | [static]
ExecRollbackHook(void *hook) | wxSQLite3FunctionContext | [static]
ExecScalarFunction(void *ctx, int argc, void **argv) | wxSQLite3FunctionContext | [static]
ExecUpdateHook(void *hook, int type, const char *database, const char *table, wxsqlite_int64 rowid) | wxSQLite3FunctionContext | [static]
GetAggregateCount() | wxSQLite3FunctionContext |
GetAggregateStruct(int len) | wxSQLite3FunctionContext |
GetArgCount() | wxSQLite3FunctionContext |
GetArgType(int argIndex) | wxSQLite3FunctionContext |
GetBlob(int argIndex, int &len) | wxSQLite3FunctionContext |
GetDouble(int argIndex, double nullValue=0) | wxSQLite3FunctionContext |
GetInt(int argIndex, int nullValue=0) | wxSQLite3FunctionContext |
GetInt64(int argIndex, wxLongLong nullValue=0) | wxSQLite3FunctionContext |
GetString(int argIndex, const wxString &nullValue=wxEmptyString) | wxSQLite3FunctionContext |
IsNull(int argIndex) | wxSQLite3FunctionContext |
SetResult(int value) | wxSQLite3FunctionContext |
SetResult(wxLongLong value) | wxSQLite3FunctionContext |
SetResult(double value) | wxSQLite3FunctionContext |
SetResult(const wxString &value) | wxSQLite3FunctionContext |
SetResult(unsigned char *value, int len) | wxSQLite3FunctionContext |
SetResultArg(int argIndex) | wxSQLite3FunctionContext |
SetResultError(const wxString &errmsg) | wxSQLite3FunctionContext |
SetResultNull() | wxSQLite3FunctionContext |


wxSqlite3: wxSQLite3Hook Class Reference

wxSQLite3Hook Class Reference

Interface for a user defined hook function. More...

#include <wxsqlite3.h>

List of all members.

Public Types

enum | wxUpdateType
Codes identifying the command for which the hook is called.

Public Member Functions

virtual | ~wxSQLite3Hook ()
Virtual destructor.
virtual bool | CommitCallback ()
Execute the commit hook callback function.
virtual void | RollbackCallback ()
Execute the rollback hook callback function.
virtual void | UpdateCallback (wxUpdateType WXUNUSED(type), const wxString &WXUNUSED(database), const wxString &WXUNUSED(table), wxLongLong WXUNUSED(rowid))
Execute the hook callback function.

Detailed Description

Interface for a user defined hook function.

Definition at line 417 of file wxsqlite3.h.

Member Function Documentation

virtual bool wxSQLite3Hook::CommitCallback ( ) [inline, virtual]

Execute the commit hook callback function.

Please refer to the SQLite documentation for further information.

Returns:
true to request rollback of the transaction, false to continue with commit

Definition at line 435 of file wxsqlite3.h.

virtual void wxSQLite3Hook::RollbackCallback ( ) [inline, virtual]

Execute the rollback hook callback function.

Please refer to the SQLite documentation for further information.

Definition at line 441 of file wxsqlite3.h.

virtual void wxSQLite3Hook::UpdateCallback | ( | wxUpdateType | WXUNUSED(type),
 |  | const wxString & | WXUNUSED(database),
 |  | const wxString & | WXUNUSED(table),
 |  | wxLongLong | WXUNUSED(rowid)
 | ) | [inline, virtual]

Execute the hook callback function.

Please refer to the SQLite documentation for further information about the meaning of the parameters.

Parameters:
type | wxHookType. The value signifies what kind of operation is to be authorized.
database | Name of the database
table | Name of the table
rowid | The rowid of the affected row

Definition at line 453 of file wxsqlite3.h.

The documentation for this class was generated from the following file:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h


wxSqlite3: Member List

wxSQLite3Hook Member List

This is the complete list of members for wxSQLite3Hook, including all inherited members.

CommitCallback() | wxSQLite3Hook | [inline, virtual]
RollbackCallback() | wxSQLite3Hook | [inline, virtual]
UpdateCallback(wxUpdateType WXUNUSED(type), const wxString &WXUNUSED(database), const wxString &WXUNUSED(table), wxLongLong WXUNUSED(rowid)) | wxSQLite3Hook | [inline, virtual]
wxUpdateType enum name | wxSQLite3Hook |
~wxSQLite3Hook() | wxSQLite3Hook | [inline, virtual]


wxSqlite3: wxSQLite3ResultSet Class Reference

wxSQLite3ResultSet Class Reference

Result set of a SQL query. More...

#include <wxsqlite3.h>

List of all members.

Public Member Functions

wxSQLite3ResultSet ()
Constructor.
wxSQLite3ResultSet (const wxSQLite3ResultSet &resultSet)
Copy constructor.
wxSQLite3ResultSet (void *db, void *stmt, bool eof, bool first=true, bool ownStmt=true)
Constructor for internal use.
wxSQLite3ResultSet & | operator= (const wxSQLite3ResultSet &resultSet)
Assignment constructor.
virtual | ~wxSQLite3ResultSet ()
Destructor.
int | GetColumnCount ()
Get the number of columns in the result set.
int | FindColumnIndex (const wxString &columnName)
Find the index of a column by name.
wxString | GetColumnName (int columnIndex)
Get the name of a column.
wxString | GetDeclaredColumnType (int columnIndex)
Get the declared type of a column.
int | GetColumnType (int columnIndex)
Get the actual type of a column.
wxString | GetAsString (int columnIndex)
Get a column as a string using the column index.
wxString | GetAsString (const wxString &columnName)
Get a column as a string using the column name.
int | GetInt (int columnIndex, int nullValue=0)
Get a column as an integer using the column index.
int | GetInt (const wxString &columnName, int nullValue=0)
Get a column as an integer using the column name.
wxLongLong | GetInt64 (int columnIndex, wxLongLong nullValue=0)
Get a column as a 64-bit integer using the column index.
wxLongLong | GetInt64 (const wxString &columnName, wxLongLong nullValue=0)
Get a column as a 64-bit integer using the column name.
double | GetDouble (int columnIndex, double nullValue=0.0)
Get a column as a double using the column index.
double | GetDouble (const wxString &columnName, double nullValue=0.0)
Get a column as a double using the column name.
wxString | GetString (int columnIndex, const wxString &nullValue=wxEmptyString)
Get a column as a string using the column index.
wxString | GetString (const wxString &columnName, const wxString &nullValue=wxEmptyString)
Get a column as a string using the column name.
const unsigned char * | GetBlob (int columnIndex, int &len)
Get a column as a BLOB using the column index.
const unsigned char * | GetBlob (const wxString &columnName, int &len)
Get a column as a BLOB using the column name.
wxDateTime | GetDate (int columnIndex)
Get a column as a date value using the column index.
wxDateTime | GetDate (const wxString &columnName)
Get a column as a date value using the column name.
wxDateTime | GetTime (int columnIndex)
Get a column as a time value using the column index.
wxDateTime | GetTime (const wxString &columnName)
Get a column as a time value using the column name.
wxDateTime | GetDateTime (int columnIndex)
Get a column as a date and time value using the column index.
wxDateTime | GetDateTime (const wxString &columnName)
Get a column as a date and time value using the column name.
wxDateTime | GetTimestamp (int columnIndex)
Get a column as a timestamp value using the column index.
wxDateTime | GetTimestamp (const wxString &columnName)
Get a column as a timestamp value using the column name.
bool | GetBool (int columnIndex)
Get a column as a boolean value using the column index.
bool | GetBool (const wxString &columnName)
Get a column as a boolean value using the column name.
bool | IsNull (int columnIndex)
Check whether a column has a NULL value using the column index.
bool | IsNull (const wxString &columnName)
Check whether a column has a NULL value using the column name.
bool | Eof ()
Check whether all rows of the result set have been processed.
bool | NextRow ()
Retrieve next row of the result set.
void | Finalize ()
Finalize the result set.

Detailed Description

Result set of a SQL query.

Definition at line 459 of file wxsqlite3.h.

Member Function Documentation

bool wxSQLite3ResultSet::Eof ( )

Check whether all rows of the result set have been processed.

Returns:
TRUE if all rows of the result have been processed, FALSE otherwise

Definition at line 621 of file wxsqlite3.cpp.

Referenced by wxSQLite3Database::ExecuteScalar().

int wxSQLite3ResultSet::FindColumnIndex ( const wxString & columnName )

Find the index of a column by name.

Parameters:
columnName name of the column
Returns:
index of the column. Indices start with 0.

Definition at line 560 of file wxsqlite3.cpp.

Referenced by GetAsString(), GetBlob(), GetBool(), GetDate(), GetDateTime(), GetDouble(), GetInt(), GetInt64(), GetString(), GetTime(), GetTimestamp(), and IsNull().

wxString wxSQLite3ResultSet::GetAsString ( const wxString & columnName )

Get a column as a string using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 331 of file wxsqlite3.cpp.

References FindColumnIndex(), and UTF8toWxString().

wxString wxSQLite3ResultSet::GetAsString ( int columnIndex )

Get a column as a string using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column as string

Definition at line 318 of file wxsqlite3.cpp.

References UTF8toWxString(), and WXSQLITE_ERROR.

const unsigned char * wxSQLite3ResultSet::GetBlob | ( | const wxString & | columnName,
 |  | int & | len
 | ) |

Get a column as a BLOB using the column name.

Parameters:
columnName | name of the column
[out] | len | length of the blob in bytes
Returns:
value of the column

Definition at line 425 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetBlob().

const unsigned char * wxSQLite3ResultSet::GetBlob | ( | int | columnIndex,
 |  | int & | len
 | ) |

Get a column as a BLOB using the column index.

Parameters:
columnIndex | index of the column. Indices start with 0.
[out] | len | length of the blob in bytes
Returns:
value of the column

Definition at line 412 of file wxsqlite3.cpp.

References WXSQLITE_ERROR.

Referenced by GetBlob().

bool wxSQLite3ResultSet::GetBool ( const wxString & columnName )

Get a column as a boolean value using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 543 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetBool().

bool wxSQLite3ResultSet::GetBool ( int columnIndex )

Get a column as a boolean value using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column

Definition at line 538 of file wxsqlite3.cpp.

References GetInt().

Referenced by GetBool().

int wxSQLite3ResultSet::GetColumnCount ( )

Get the number of columns in the result set.

Returns:
number of columns in result set

Definition at line 312 of file wxsqlite3.cpp.

Referenced by wxSQLite3Database::ExecuteScalar().

wxString wxSQLite3ResultSet::GetColumnName ( int columnIndex )

Get the name of a column.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
column name as string

Definition at line 583 of file wxsqlite3.cpp.

References UTF8toWxString(), wxERRMSG_INVALID_INDEX, and WXSQLITE_ERROR.

int wxSQLite3ResultSet::GetColumnType ( int columnIndex )

Get the actual type of a column.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
column type as one of the values WXSQLITE_INTEGER, WXSQLITE_FLOAT, WXSQLITE_TEXT, WXSQLITE_BLOB, or WXSQLITE_NULL

Definition at line 609 of file wxsqlite3.cpp.

References wxERRMSG_INVALID_INDEX, and WXSQLITE_ERROR.

Referenced by GetDate(), GetDateTime(), GetDouble(), GetInt(), GetInt64(), GetString(), GetTime(), GetTimestamp(), and IsNull().

wxDateTime wxSQLite3ResultSet::GetDate ( const wxString & columnName )

Get a column as a date value using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 452 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetDate().

wxDateTime wxSQLite3ResultSet::GetDate ( int columnIndex )

Get a column as a date value using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column

Definition at line 432 of file wxsqlite3.cpp.

References GetColumnType(), and GetString().

Referenced by GetDate().

wxDateTime wxSQLite3ResultSet::GetDateTime ( const wxString & columnName )

Get a column as a date and time value using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 506 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetDateTime().

wxDateTime wxSQLite3ResultSet::GetDateTime ( int columnIndex )

Get a column as a date and time value using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column

Definition at line 485 of file wxsqlite3.cpp.

References GetColumnType(), and GetString().

Referenced by GetDateTime().

wxString wxSQLite3ResultSet::GetDeclaredColumnType ( int columnIndex )

Get the declared type of a column.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
type string as specified in the table definition

Definition at line 596 of file wxsqlite3.cpp.

References UTF8toWxString(), wxERRMSG_INVALID_INDEX, and WXSQLITE_ERROR.

double wxSQLite3ResultSet::GetDouble | ( | const wxString & | columnName,
 |  | double | nullValue = 0.0
 | ) |

Get a column as a double using the column name.

Parameters:
columnName | name of the column
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 387 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetDouble().

double wxSQLite3ResultSet::GetDouble | ( | int | columnIndex,
 |  | double | nullValue = 0.0
 | ) |

Get a column as a double using the column index.

Parameters:
columnIndex | index of the column. Indices start with 0.
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 375 of file wxsqlite3.cpp.

References GetColumnType().

Referenced by GetDouble().

int wxSQLite3ResultSet::GetInt | ( | const wxString & | columnName,
 |  | int | nullValue = 0
 | ) |

Get a column as an integer using the column name.

Parameters:
columnName | name of the column
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 351 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetInt().

int wxSQLite3ResultSet::GetInt | ( | int | columnIndex,
 |  | int | nullValue = 0
 | ) |

Get a column as an integer using the column index.

Parameters:
columnIndex | index of the column. Indices start with 0.
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 338 of file wxsqlite3.cpp.

References GetColumnType().

Referenced by GetBool(), and GetInt().

wxLongLong wxSQLite3ResultSet::GetInt64 | ( | const wxString & | columnName,
 |  | wxLongLong | nullValue = 0
 | ) |

Get a column as a 64-bit integer using the column name.

Parameters:
columnName | name of the column
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 369 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetInt64().

wxLongLong wxSQLite3ResultSet::GetInt64 | ( | int | columnIndex,
 |  | wxLongLong | nullValue = 0
 | ) |

Get a column as a 64-bit integer using the column index.

Parameters:
columnIndex | index of the column. Indices start with 0.
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 357 of file wxsqlite3.cpp.

References GetColumnType().

Referenced by GetInt64().

wxString wxSQLite3ResultSet::GetString | ( | const wxString & | columnName,
 |  | const wxString & | nullValue = wxEmptyString
 | ) |

Get a column as a string using the column name.

Parameters:
columnName | name of the column
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 406 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetString().

wxString wxSQLite3ResultSet::GetString | ( | int | columnIndex,
 |  | const wxString & | nullValue = wxEmptyString
 | ) |

Get a column as a string using the column index.

Parameters:
columnIndex | index of the column. Indices start with 0.
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 393 of file wxsqlite3.cpp.

References GetColumnType(), and UTF8toWxString().

Referenced by GetDate(), GetDateTime(), GetString(), GetTime(), and GetTimestamp().

wxDateTime wxSQLite3ResultSet::GetTime ( const wxString & columnName )

Get a column as a time value using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 479 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetTime().

wxDateTime wxSQLite3ResultSet::GetTime ( int columnIndex )

Get a column as a time value using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column

Definition at line 459 of file wxsqlite3.cpp.

References GetColumnType(), and GetString().

Referenced by GetTime().

wxDateTime wxSQLite3ResultSet::GetTimestamp ( const wxString & columnName )

Get a column as a timestamp value using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 532 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetTimestamp().

wxDateTime wxSQLite3ResultSet::GetTimestamp ( int columnIndex )

Get a column as a timestamp value using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column

Definition at line 512 of file wxsqlite3.cpp.

References GetColumnType(), and GetString().

Referenced by GetTimestamp().

bool wxSQLite3ResultSet::IsNull ( const wxString & columnName )

Check whether a column has a NULL value using the column name.

Parameters:
columnName name of the column
Returns:
TRUE if the value is NULL, FALSE otherwise

Definition at line 554 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetColumnType().

bool wxSQLite3ResultSet::IsNull ( int columnIndex )

Check whether a column has a NULL value using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
TRUE if the value is NULL, FALSE otherwise

Definition at line 549 of file wxsqlite3.cpp.

References GetColumnType().

bool wxSQLite3ResultSet::NextRow ( )

Retrieve next row of the result set.

Advances the cursor to the next row. On creation of the result set the cursor is positioned BEFORE the first row, i.e. the first call to this method makes the first row available for processing.

Returns:
TRUE while there are still rows to process, FALSE otherwise

Definition at line 627 of file wxsqlite3.cpp.

References UTF8toWxString().

The documentation for this class was generated from the following files:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp


wxSqlite3: Member List

wxSQLite3ResultSet Member List

This is the complete list of members for wxSQLite3ResultSet, including all inherited members.

Eof() | wxSQLite3ResultSet |
Finalize() | wxSQLite3ResultSet |
FindColumnIndex(const wxString &columnName) | wxSQLite3ResultSet |
GetAsString(int columnIndex) | wxSQLite3ResultSet |
GetAsString(const wxString &columnName) | wxSQLite3ResultSet |
GetBlob(int columnIndex, int &len) | wxSQLite3ResultSet |
GetBlob(const wxString &columnName, int &len) | wxSQLite3ResultSet |
GetBool(int columnIndex) | wxSQLite3ResultSet |
GetBool(const wxString &columnName) | wxSQLite3ResultSet |
GetColumnCount() | wxSQLite3ResultSet |
GetColumnName(int columnIndex) | wxSQLite3ResultSet |
GetColumnType(int columnIndex) | wxSQLite3ResultSet |
GetDate(int columnIndex) | wxSQLite3ResultSet |
GetDate(const wxString &columnName) | wxSQLite3ResultSet |
GetDateTime(int columnIndex) | wxSQLite3ResultSet |
GetDateTime(const wxString &columnName) | wxSQLite3ResultSet |
GetDeclaredColumnType(int columnIndex) | wxSQLite3ResultSet |
GetDouble(int columnIndex, double nullValue=0.0) | wxSQLite3ResultSet |
GetDouble(const wxString &columnName, double nullValue=0.0) | wxSQLite3ResultSet |
GetInt(int columnIndex, int nullValue=0) | wxSQLite3ResultSet |
GetInt(const wxString &columnName, int nullValue=0) | wxSQLite3ResultSet |
GetInt64(int columnIndex, wxLongLong nullValue=0) | wxSQLite3ResultSet |
GetInt64(const wxString &columnName, wxLongLong nullValue=0) | wxSQLite3ResultSet |
GetString(int columnIndex, const wxString &nullValue=wxEmptyString) | wxSQLite3ResultSet |
GetString(const wxString &columnName, const wxString &nullValue=wxEmptyString) | wxSQLite3ResultSet |
GetTime(int columnIndex) | wxSQLite3ResultSet |
GetTime(const wxString &columnName) | wxSQLite3ResultSet |
GetTimestamp(int columnIndex) | wxSQLite3ResultSet |
GetTimestamp(const wxString &columnName) | wxSQLite3ResultSet |
IsNull(int columnIndex) | wxSQLite3ResultSet |
IsNull(const wxString &columnName) | wxSQLite3ResultSet |
NextRow() | wxSQLite3ResultSet |
operator=(const wxSQLite3ResultSet &resultSet) | wxSQLite3ResultSet |
wxSQLite3ResultSet() | wxSQLite3ResultSet |
wxSQLite3ResultSet(const wxSQLite3ResultSet &resultSet) | wxSQLite3ResultSet |
wxSQLite3ResultSet(void *db, void *stmt, bool eof, bool first=true, bool ownStmt=true) | wxSQLite3ResultSet |
~wxSQLite3ResultSet() | wxSQLite3ResultSet | [virtual]


wxSqlite3: wxSQLite3ScalarFunction Class Reference

wxSQLite3ScalarFunction Class Reference

Interface for user defined scalar functions. More...

#include <wxsqlite3.h>

List of all members.

Public Member Functions

virtual | ~wxSQLite3ScalarFunction ()
Virtual destructor.
virtual void | Execute (wxSQLite3FunctionContext &ctx)=0
Execute the scalar function.

Detailed Description

Interface for user defined scalar functions.

Definition at line 303 of file wxsqlite3.h.

Member Function Documentation

virtual void wxSQLite3ScalarFunction::Execute ( wxSQLite3FunctionContext & ctx ) [pure virtual]

Execute the scalar function.

This method is invoked for each appearance of the scalar function in the SQL query.

Parameters:
ctx function context which can be used to access arguments and result value

Referenced by wxSQLite3FunctionContext::ExecScalarFunction().

The documentation for this class was generated from the following file:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h


wxSqlite3: Member List

wxSQLite3ScalarFunction Member List

This is the complete list of members for wxSQLite3ScalarFunction, including all inherited members.

Execute(wxSQLite3FunctionContext &ctx)=0 | wxSQLite3ScalarFunction | [pure virtual]
~wxSQLite3ScalarFunction() | wxSQLite3ScalarFunction | [inline, virtual]


wxSqlite3: wxSQLite3Statement Class Reference

wxSQLite3Statement Class Reference

Represents a prepared SQL statement. More...

#include <wxsqlite3.h>

List of all members.

Public Member Functions

wxSQLite3Statement ()
Constructor.
wxSQLite3Statement (const wxSQLite3Statement &statement)
Copy constructor.
wxSQLite3Statement & | operator= (const wxSQLite3Statement &statement)
Assignement constructor.
wxSQLite3Statement (void *db, void *stmt)
Constructor (internal use only).
virtual | ~wxSQLite3Statement ()
Destructor.
int | ExecuteUpdate ()
Execute the database update represented by this statement.
wxSQLite3ResultSet ExecuteQuery ()
Execute the query represented by this statement.
int | GetParamCount ()
Get the number of statement parameters.
int | GetParamIndex (const wxString &paramName)
Get the index of a parameter with a given name.
wxString | GetParamName (int paramIndex)
Get the name of a paramater at the given position.
void | Bind (int paramIndex, const wxString &stringValue)
Bind parameter to a string value.
void | Bind (int paramIndex, int intValue)
Bind parameter to a integer value.
void | Bind (int paramIndex, wxLongLong int64Value)
Bind parameter to a 64-bit integer value.
void | Bind (int paramIndex, double doubleValue)
Bind parameter to a double value.
void | Bind (int paramIndex, const char *charValue)
Bind parameter to a utf-8 character string value.
void | Bind (int paramIndex, const unsigned char *blobValue, int blobLen)
Bind parameter to a BLOB value.
void | BindDate (int paramIndex, const wxDateTime &date)
Bind parameter to a date value.
void | BindTime (int paramIndex, const wxDateTime &time)
Bind parameter to a time value.
void | BindDateTime (int paramIndex, const wxDateTime &datetime)
Bind parameter to a date and time value.
void | BindTimestamp (int paramIndex, const wxDateTime &timestamp)
Bind parameter to a timestamp value.
void | BindBool (int paramIndex, bool value)
Bind parameter to a boolean value.
void | BindNull (int paramIndex)
Bind parameter to a NULL value.
void | ClearBindings ()
Clear all parameter bindings.
void | Reset ()
Reset the prepared statement.
void | Finalize ()
Finalize the prepared staement.

Detailed Description

Represents a prepared SQL statement.

Definition at line 966 of file wxsqlite3.h.

Member Function Documentation

void wxSQLite3Statement::Bind | ( | int | paramIndex,
 |  | const unsigned char * | blobValue,
 |  | int | blobLen
 | ) |

Bind parameter to a BLOB value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
blobValue | value of the parameter
blobLen | length of the blob in bytes

Definition at line 1255 of file wxsqlite3.cpp.

References wxERRMSG_BIND_BLOB.

void wxSQLite3Statement::Bind | ( | int | paramIndex,
 |  | const char * | charValue
 | ) |

Bind parameter to a utf-8 character string value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
charValue | value of the parameter

Definition at line 1244 of file wxsqlite3.cpp.

References wxERRMSG_BIND_STR.

void wxSQLite3Statement::Bind | ( | int | paramIndex,
 |  | double | doubleValue
 | ) |

Bind parameter to a double value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
doubleValue | value of the parameter

Definition at line 1233 of file wxsqlite3.cpp.

References wxERRMSG_BIND_DBL.

void wxSQLite3Statement::Bind | ( | int | paramIndex,
 |  | wxLongLong | int64Value
 | ) |

Bind parameter to a 64-bit integer value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
int64Value | value of the parameter

Definition at line 1222 of file wxsqlite3.cpp.

References wxERRMSG_BIND_INT64.

void wxSQLite3Statement::Bind | ( | int | paramIndex,
 |  | int | intValue
 | ) |

Bind parameter to a integer value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
intValue | value of the parameter

Definition at line 1211 of file wxsqlite3.cpp.

References wxERRMSG_BIND_INT.

void wxSQLite3Statement::Bind | ( | int | paramIndex,
 |  | const wxString & | stringValue
 | ) |

Bind parameter to a string value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
stringValue | value of the parameter

Definition at line 1196 of file wxsqlite3.cpp.

References wxERRMSG_BIND_STR.

Referenced by BindBool(), BindDate(), BindDateTime(), BindTime(), and BindTimestamp().

void wxSQLite3Statement::BindBool | ( | int | paramIndex,
 |  | bool | value
 | ) |

Bind parameter to a boolean value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
value | value of the parameter

Definition at line 1315 of file wxsqlite3.cpp.

References Bind().

void wxSQLite3Statement::BindDate | ( | int | paramIndex,
 |  | const wxDateTime & | date
 | ) |

Bind parameter to a date value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
date | value of the parameter

Definition at line 1267 of file wxsqlite3.cpp.

References Bind().

void wxSQLite3Statement::BindDateTime | ( | int | paramIndex,
 |  | const wxDateTime & | datetime
 | ) |

Bind parameter to a date and time value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
datetime | value of the parameter

Definition at line 1291 of file wxsqlite3.cpp.

References Bind().

void wxSQLite3Statement::BindNull ( int paramIndex )

Bind parameter to a NULL value.

Parameters:
paramIndex index of the parameter. The first parameter has an index of 1.

Definition at line 1320 of file wxsqlite3.cpp.

References wxERRMSG_BIND_NULL.

Referenced by ClearBindings().

void wxSQLite3Statement::BindTime | ( | int | paramIndex,
 |  | const wxDateTime & | time
 | ) |

Bind parameter to a time value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
time | value of the parameter

Definition at line 1279 of file wxsqlite3.cpp.

References Bind().

void wxSQLite3Statement::BindTimestamp | ( | int | paramIndex,
 |  | const wxDateTime & | timestamp
 | ) |

Bind parameter to a timestamp value.

Parameters:
paramIndex | index of the parameter. The first parameter has an index of 1.
timestamp | value of the parameter

Definition at line 1303 of file wxsqlite3.cpp.

References Bind().

void wxSQLite3Statement::ClearBindings ( )

Clear all parameter bindings.

Sets all the parameters in the prepared SQL statement back to NULL.

Definition at line 1331 of file wxsqlite3.cpp.

References BindNull(), GetParamCount(), and wxERRMSG_BIND_CLEAR.

wxSQLite3ResultSet wxSQLite3Statement::ExecuteQuery ( )

Execute the query represented by this statement.

Returns:
result set instance

Definition at line 1150 of file wxsqlite3.cpp.

References UTF8toWxString().

int wxSQLite3Statement::ExecuteUpdate ( )

Execute the database update represented by this statement.

Returns:
the number of database rows that were changed (or inserted or deleted)

Definition at line 1119 of file wxsqlite3.cpp.

References UTF8toWxString().

int wxSQLite3Statement::GetParamCount ( )

Get the number of statement parameters.

Returns:
the number of parameters in the prepared statement

Definition at line 1173 of file wxsqlite3.cpp.

Referenced by ClearBindings().

int wxSQLite3Statement::GetParamIndex ( const wxString & paramName )

Get the index of a parameter with a given name.

Parameters:
paramName
Returns:
the index of the parameter with the given name. The name must match exactly. If there is no parameter with the given name, return 0.

Definition at line 1179 of file wxsqlite3.cpp.

wxString wxSQLite3Statement::GetParamName ( int paramIndex )

Get the name of a paramater at the given position.

Parameters:
paramIndex index of the parameter. The first parameter has an index of 1.
Returns:
the name of the paramIndex-th parameter in the precompiled statement. Parameters of the form ":AAA" or "$VVV" have a name which is the string ":AAA" or "$VVV". Parameters of the form "?" have no name.

Definition at line 1189 of file wxsqlite3.cpp.

References UTF8toWxString().

void wxSQLite3Statement::Reset ( )

Reset the prepared statement.

Resets the statement back to it's initial state, ready to be re-executed. Any SQL statement variables that had values bound to them retain their values.

Definition at line 1349 of file wxsqlite3.cpp.

References UTF8toWxString().

The documentation for this class was generated from the following files:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp


wxSqlite3: Member List

wxSQLite3Statement Member List

This is the complete list of members for wxSQLite3Statement, including all inherited members.

Bind(int paramIndex, const wxString &stringValue) | wxSQLite3Statement |
Bind(int paramIndex, int intValue) | wxSQLite3Statement |
Bind(int paramIndex, wxLongLong int64Value) | wxSQLite3Statement |
Bind(int paramIndex, double doubleValue) | wxSQLite3Statement |
Bind(int paramIndex, const char *charValue) | wxSQLite3Statement |
Bind(int paramIndex, const unsigned char *blobValue, int blobLen) | wxSQLite3Statement |
BindBool(int paramIndex, bool value) | wxSQLite3Statement |
BindDate(int paramIndex, const wxDateTime &date) | wxSQLite3Statement |
BindDateTime(int paramIndex, const wxDateTime &datetime) | wxSQLite3Statement |
BindNull(int paramIndex) | wxSQLite3Statement |
BindTime(int paramIndex, const wxDateTime &time) | wxSQLite3Statement |
BindTimestamp(int paramIndex, const wxDateTime &timestamp) | wxSQLite3Statement |
ClearBindings() | wxSQLite3Statement |
ExecuteQuery() | wxSQLite3Statement |
ExecuteUpdate() | wxSQLite3Statement |
Finalize() | wxSQLite3Statement |
GetParamCount() | wxSQLite3Statement |
GetParamIndex(const wxString &paramName) | wxSQLite3Statement |
GetParamName(int paramIndex) | wxSQLite3Statement |
operator=(const wxSQLite3Statement &statement) | wxSQLite3Statement |
Reset() | wxSQLite3Statement |
wxSQLite3Statement() | wxSQLite3Statement |
wxSQLite3Statement(const wxSQLite3Statement &statement) | wxSQLite3Statement |
wxSQLite3Statement(void *db, void *stmt) | wxSQLite3Statement |
~wxSQLite3Statement() | wxSQLite3Statement | [virtual]


wxSqlite3: wxSQLite3StatementBuffer Class Reference

wxSQLite3StatementBuffer Class Reference

SQL statment buffer for use with SQLite3's printf method. More...

#include <wxsqlite3.h>

List of all members.

Public Member Functions

wxSQLite3StatementBuffer ()
Constructor.
~wxSQLite3StatementBuffer ()
Destructor.
const char * | Format (const char *format,...)
Format a SQL statement using SQLite3's printf method.
operator const char * () const
Dereference the internal buffer.
void | Clear ()
Clear the internal buffer.

Detailed Description

SQL statment buffer for use with SQLite3's printf method.

Definition at line 74 of file wxsqlite3.h.

Member Function Documentation

const char * wxSQLite3StatementBuffer::Format | ( | const char * | format,
 |  |  | ...
 | ) |

Format a SQL statement using SQLite3's printf method.

This method is a variant of the "sprintf()" from the standard C library. All of the usual printf formatting options apply. In addition, there is a "%q" option. q works like s in that it substitutes a null-terminated string from the argument list. But q also doubles every '\'' character. q is designed for use inside a string literal. By doubling each '\'' character it escapes that character and allows it to be inserted into the string.

For example, so some string variable contains text as follows:

char *zText = "It's a happy day!";

One can use this text in an SQL statement as follows:

wxSQLite3StatementBuffer stmtBuffer; stmtBuffer.Format("INSERT INTO table VALUES('%q')", zText);

Because the q format string is used, the '\'' character in zText is escaped and the SQL generated is as follows:

INSERT INTO table1 VALUES('It''s a happy day!')

Parameters:
format SQL statement string with formatting options
... list of statement parameters
Returns:
const char pointer to the resulting statement buffer

Definition at line 234 of file wxsqlite3.cpp.

References Clear().

wxSQLite3StatementBuffer::operator const char * ( ) const [inline]

Dereference the internal buffer.

Returns:
const char pointer to the resulting statement buffer

Definition at line 117 of file wxsqlite3.h.

The documentation for this class was generated from the following files:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp


wxSqlite3: Member List

wxSQLite3StatementBuffer Member List

This is the complete list of members for wxSQLite3StatementBuffer, including all inherited members.

Clear() | wxSQLite3StatementBuffer |
Format(const char *format,...) | wxSQLite3StatementBuffer |
operator const char *() const | wxSQLite3StatementBuffer | [inline]
wxSQLite3StatementBuffer() | wxSQLite3StatementBuffer |
~wxSQLite3StatementBuffer() | wxSQLite3StatementBuffer |


wxSqlite3: wxSQLite3Table Class Reference

wxSQLite3Table Class Reference

Holds the complete result set of a SQL query. More...

#include <wxsqlite3.h>

List of all members.

Public Member Functions

wxSQLite3Table ()
Constructor.
wxSQLite3Table (const wxSQLite3Table &table)
wxSQLite3Table (char **results, int rows, int cols)
virtual | ~wxSQLite3Table ()
wxSQLite3Table & | operator= (const wxSQLite3Table &table)
int | GetColumnCount ()
Get the number of columns in the result set.
int | GetRowCount ()
Get the number of rows in the result set.
int | FindColumnIndex (const wxString &columnName)
Find the index of a column by name.
wxString | GetColumnName (int columnIndex)
Get the name of a column.
wxString | GetAsString (int columnIndex)
Get a column as a string using the column index.
wxString | GetAsString (const wxString &columnName)
Get a column as a string using the column name.
int | GetInt (int columnIndex, int nullValue=0)
Get a column as an integer using the column index.
int | GetInt (const wxString &columnName, int nullValue=0)
Get a column as an integer using the column name.
wxLongLong | GetInt64 (int columnIndex, wxLongLong nullValue=0)
Get a column as a 64-bit integer using the column index.
wxLongLong | GetInt64 (const wxString &columnName, wxLongLong nullValue=0)
Get a column as an integer using the column name.
double | GetDouble (int columnIndex, double nullValue=0.0)
Get a column as a double using the column index.
double | GetDouble (const wxString &columnName, double nullValue=0.0)
Get a column as a double using the column name.
wxString | GetString (int columnIndex, const wxString &nullValue=wxEmptyString)
Get a column as a string using the column index.
wxString | GetString (const wxString &columnName, const wxString &nullValue=wxEmptyString)
Get a column as a string using the column name.
wxDateTime | GetDate (int columnIndex)
Get a column as a date value using the column index.
wxDateTime | GetDate (const wxString &columnName)
Get a column as a date value using the column name.
wxDateTime | GetTime (int columnIndex)
Get a column as a time value using the column index.
wxDateTime | GetTime (const wxString &columnName)
Get a column as a time value using the column name.
wxDateTime | GetDateTime (int columnIndex)
Get a column as a date/time value using the column index.
wxDateTime | GetDateTime (const wxString &columnName)
Get a column as a date/time value using the column name.
bool | GetBool (int columnIndex)
Get a column as a boolean using the column index.
bool | GetBool (const wxString &columnName)
Get a column as a boolean using the column name.
bool | IsNull (int columnIndex)
Check whether the column selected by index is a NULL value.
bool | IsNull (const wxString &columnName)
Check whether the column selected by name is a NULL value.
void | SetRow (int row)
Set the current row.
void | Finalize ()
Finalize the result set.

Detailed Description

Holds the complete result set of a SQL query.

Definition at line 755 of file wxsqlite3.h.

Member Function Documentation

int wxSQLite3Table::FindColumnIndex ( const wxString & columnName )

Find the index of a column by name.

Parameters:
columnName name of the column
Returns:
the index of the column

Definition at line 811 of file wxsqlite3.cpp.

Referenced by GetAsString(), GetBool(), GetDate(), GetDateTime(), GetTime(), and IsNull().

wxString wxSQLite3Table::GetAsString ( const wxString & columnName )

Get a column as a string using the column name.

Parameters:
columnName name of the column
Returns:
value of the column as a string

Definition at line 844 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetAsString().

wxString wxSQLite3Table::GetAsString ( int columnIndex )

Get a column as a string using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column as a string

Definition at line 832 of file wxsqlite3.cpp.

References UTF8toWxString(), wxERRMSG_INVALID_INDEX, and WXSQLITE_ERROR.

Referenced by GetAsString(), GetDouble(), GetInt(), GetInt64(), and GetString().

bool wxSQLite3Table::GetBool ( const wxString & columnName )

Get a column as a boolean using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 1016 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetBool().

bool wxSQLite3Table::GetBool ( int columnIndex )

Get a column as a boolean using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column

Definition at line 1011 of file wxsqlite3.cpp.

References GetInt().

Referenced by GetBool().

int wxSQLite3Table::GetColumnCount ( )

Get the number of columns in the result set.

Returns:
the number of columns

Definition at line 799 of file wxsqlite3.cpp.

wxString wxSQLite3Table::GetColumnName ( int columnIndex )

Get the name of a column.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
name of the column

Definition at line 1042 of file wxsqlite3.cpp.

References UTF8toWxString(), wxERRMSG_INVALID_INDEX, and WXSQLITE_ERROR.

wxDateTime wxSQLite3Table::GetDate ( const wxString & columnName )

Get a column as a date value using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 967 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetDate().

wxDateTime wxSQLite3Table::GetDate ( int columnIndex )

Get a column as a date value using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column

Definition at line 954 of file wxsqlite3.cpp.

References GetString().

Referenced by GetDate().

wxDateTime wxSQLite3Table::GetDateTime ( const wxString & columnName )

Get a column as a date/time value using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 1005 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetDateTime().

wxDateTime wxSQLite3Table::GetDateTime ( int columnIndex )

Get a column as a date/time value using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column

Definition at line 992 of file wxsqlite3.cpp.

References GetString().

Referenced by GetDateTime().

double wxSQLite3Table::GetDouble | ( | const wxString & | columnName,
 |  | double | nullValue = 0.0
 | ) |

Get a column as a double using the column name.

Parameters:
columnName | name of the column
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 916 of file wxsqlite3.cpp.

References GetAsString(), and IsNull().

double wxSQLite3Table::GetDouble | ( | int | columnIndex,
 |  | double | nullValue = 0.0
 | ) |

Get a column as a double using the column index.

Parameters:
columnIndex | index of the column. Indices start with 0.
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 902 of file wxsqlite3.cpp.

References GetAsString(), and IsNull().

int wxSQLite3Table::GetInt | ( | const wxString & | columnName,
 |  | int | nullValue = 0
 | ) |

Get a column as an integer using the column name.

Parameters:
columnName | name of the column
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 864 of file wxsqlite3.cpp.

References GetAsString(), and IsNull().

int wxSQLite3Table::GetInt | ( | int | columnIndex,
 |  | int | nullValue = 0
 | ) |

Get a column as an integer using the column index.

Parameters:
columnIndex | index of the column. Indices start with 0.
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 850 of file wxsqlite3.cpp.

References GetAsString(), and IsNull().

Referenced by GetBool().

wxLongLong wxSQLite3Table::GetInt64 | ( | const wxString & | columnName,
 |  | wxLongLong | nullValue = 0
 | ) |

Get a column as an integer using the column name.

Parameters:
columnName | name of the column
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 890 of file wxsqlite3.cpp.

References ConvertStringToLongLong(), GetAsString(), and IsNull().

wxLongLong wxSQLite3Table::GetInt64 | ( | int | columnIndex,
 |  | wxLongLong | nullValue = 0
 | ) |

Get a column as a 64-bit integer using the column index.

Parameters:
columnIndex | index of the column. Indices start with 0.
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 878 of file wxsqlite3.cpp.

References ConvertStringToLongLong(), GetAsString(), and IsNull().

int wxSQLite3Table::GetRowCount ( )

Get the number of rows in the result set.

Returns:
the number of rows

Definition at line 805 of file wxsqlite3.cpp.

wxString wxSQLite3Table::GetString | ( | const wxString & | columnName,
 |  | const wxString & | nullValue = wxEmptyString
 | ) |

Get a column as a string using the column name.

Parameters:
columnName | name of the column
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 942 of file wxsqlite3.cpp.

References GetAsString(), and IsNull().

wxString wxSQLite3Table::GetString | ( | int | columnIndex,
 |  | const wxString & | nullValue = wxEmptyString
 | ) |

Get a column as a string using the column index.

Parameters:
columnIndex | index of the column. Indices start with 0.
nullValue | value to be returned in case the column is NULL
Returns:
value of the column

Definition at line 930 of file wxsqlite3.cpp.

References GetAsString(), and IsNull().

Referenced by GetDate(), GetDateTime(), and GetTime().

wxDateTime wxSQLite3Table::GetTime ( const wxString & columnName )

Get a column as a time value using the column name.

Parameters:
columnName name of the column
Returns:
value of the column

Definition at line 986 of file wxsqlite3.cpp.

References FindColumnIndex(), and GetTime().

wxDateTime wxSQLite3Table::GetTime ( int columnIndex )

Get a column as a time value using the column index.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
value of the column

Definition at line 973 of file wxsqlite3.cpp.

References GetString().

Referenced by GetTime().

bool wxSQLite3Table::IsNull ( const wxString & columnName )

Check whether the column selected by name is a NULL value.

Parameters:
columnName name of the column
Returns:
TRUE if the value is NULL, FALSE otherwise

Definition at line 1036 of file wxsqlite3.cpp.

References FindColumnIndex(), and IsNull().

bool wxSQLite3Table::IsNull ( int columnIndex )

Check whether the column selected by index is a NULL value.

Parameters:
columnIndex index of the column. Indices start with 0.
Returns:
TRUE if the value is NULL, FALSE otherwise

Definition at line 1022 of file wxsqlite3.cpp.

References wxERRMSG_INVALID_INDEX, and WXSQLITE_ERROR.

Referenced by GetDouble(), GetInt(), GetInt64(), GetString(), and IsNull().

void wxSQLite3Table::SetRow ( int row )

Set the current row.

Parameters:
row index of the requested row. Indices start with 0.

Definition at line 1055 of file wxsqlite3.cpp.

References wxERRMSG_INVALID_ROW, and WXSQLITE_ERROR.

The documentation for this class was generated from the following files:
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h
  • C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp


wxSqlite3: Member List

wxSQLite3Table Member List

This is the complete list of members for wxSQLite3Table, including all inherited members.

Finalize() | wxSQLite3Table |
FindColumnIndex(const wxString &columnName) | wxSQLite3Table |
GetAsString(int columnIndex) | wxSQLite3Table |
GetAsString(const wxString &columnName) | wxSQLite3Table |
GetBool(int columnIndex) | wxSQLite3Table |
GetBool(const wxString &columnName) | wxSQLite3Table |
GetColumnCount() | wxSQLite3Table |
GetColumnName(int columnIndex) | wxSQLite3Table |
GetDate(int columnIndex) | wxSQLite3Table |
GetDate(const wxString &columnName) | wxSQLite3Table |
GetDateTime(int columnIndex) | wxSQLite3Table |
GetDateTime(const wxString &columnName) | wxSQLite3Table |
GetDouble(int columnIndex, double nullValue=0.0) | wxSQLite3Table |
GetDouble(const wxString &columnName, double nullValue=0.0) | wxSQLite3Table |
GetInt(int columnIndex, int nullValue=0) | wxSQLite3Table |
GetInt(const wxString &columnName, int nullValue=0) | wxSQLite3Table |
GetInt64(int columnIndex, wxLongLong nullValue=0) | wxSQLite3Table |
GetInt64(const wxString &columnName, wxLongLong nullValue=0) | wxSQLite3Table |
GetRowCount() | wxSQLite3Table |
GetString(int columnIndex, const wxString &nullValue=wxEmptyString) | wxSQLite3Table |
GetString(const wxString &columnName, const wxString &nullValue=wxEmptyString) | wxSQLite3Table |
GetTime(int columnIndex) | wxSQLite3Table |
GetTime(const wxString &columnName) | wxSQLite3Table |
IsNull(int columnIndex) | wxSQLite3Table |
IsNull(const wxString &columnName) | wxSQLite3Table |
operator=(const wxSQLite3Table &table) | wxSQLite3Table |
SetRow(int row) | wxSQLite3Table |
wxSQLite3Table() | wxSQLite3Table |
wxSQLite3Table(const wxSQLite3Table &table) | wxSQLite3Table |
wxSQLite3Table(char **results, int rows, int cols) | wxSQLite3Table |
~wxSQLite3Table() | wxSQLite3Table | [virtual]


wxSqlite3: File Index

  • File List
  • File Members

wxSqlite3 File List

Here is a list of all documented files with brief descriptions:
C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp [code] | Implementation of the wxSQLite3 class
C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h [code] | Interface of the wxSQLite3 class
C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3def.h [code] | Compile time switches for the wxSQLite3 class
C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3dyn.h [code] | Definition of the SQLite3 API functions
Generated on Fri Aug 4 12:22:56 2006 for wxSqlite3 by doxygen 1.4.6-NO


wxSqlite3: Class Members

  • All
  • Functions
  • Enumerations
  • a
  • b
  • c
  • e
  • f
  • g
  • i
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
  • ~

Here is a list of all documented class members with links to the class documentation for each member:

- a -

  • Aggregate() : wxSQLite3AggregateFunction
  • AuthorizationCodeToString() : wxSQLite3Authorizer
  • Authorize() : wxSQLite3Authorizer

- b -

  • Begin() : wxSQLite3Database
  • Bind() : wxSQLite3Statement
  • BindBool() : wxSQLite3Statement
  • BindDate() : wxSQLite3Statement
  • BindDateTime() : wxSQLite3Statement
  • BindNull() : wxSQLite3Statement
  • BindTime() : wxSQLite3Statement
  • BindTimestamp() : wxSQLite3Statement

- c -

  • CheckSyntax() : wxSQLite3Database
  • Clear() : wxSQLite3StatementBuffer
  • ClearBindings() : wxSQLite3Statement
  • Close() : wxSQLite3Database
  • Commit() : wxSQLite3Database
  • CommitCallback() : wxSQLite3Hook
  • CreateFunction() : wxSQLite3Database

- e -

  • Eof() : wxSQLite3ResultSet
  • ErrorCodeAsString() : wxSQLite3Exception
  • ExecAggregateFinalize() : wxSQLite3FunctionContext
  • ExecAggregateStep() : wxSQLite3FunctionContext
  • ExecAuthorizer() : wxSQLite3FunctionContext
  • ExecCommitHook() : wxSQLite3FunctionContext
  • ExecRollbackHook() : wxSQLite3FunctionContext
  • ExecScalarFunction() : wxSQLite3FunctionContext
  • ExecUpdateHook() : wxSQLite3FunctionContext
  • Execute() : wxSQLite3ScalarFunction
  • ExecuteQuery() : wxSQLite3Database, wxSQLite3Statement
  • ExecuteScalar() : wxSQLite3Database
  • ExecuteUpdate() : wxSQLite3Database, wxSQLite3Statement

- f -

  • Finalize() : wxSQLite3Statement, wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3AggregateFunction
  • FindColumnIndex() : wxSQLite3Table, wxSQLite3ResultSet
  • Format() : wxSQLite3StatementBuffer

- g -

  • GetAggregateCount() : wxSQLite3FunctionContext
  • GetAggregateStruct() : wxSQLite3FunctionContext
  • GetArgCount() : wxSQLite3FunctionContext
  • GetArgType() : wxSQLite3FunctionContext
  • GetAsString() : wxSQLite3Table, wxSQLite3ResultSet
  • GetAutoCommit() : wxSQLite3Database
  • GetBlob() : wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetBool() : wxSQLite3Table, wxSQLite3ResultSet
  • GetColumnCount() : wxSQLite3Table, wxSQLite3ResultSet
  • GetColumnName() : wxSQLite3Table, wxSQLite3ResultSet
  • GetColumnType() : wxSQLite3ResultSet
  • GetDate() : wxSQLite3Table, wxSQLite3ResultSet
  • GetDateTime() : wxSQLite3Table, wxSQLite3ResultSet
  • GetDeclaredColumnType() : wxSQLite3ResultSet
  • GetDouble() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetErrorCode() : wxSQLite3Exception
  • GetInt() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetInt64() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetLastRowId() : wxSQLite3Database
  • GetMessage() : wxSQLite3Exception
  • GetParamCount() : wxSQLite3Statement
  • GetParamIndex() : wxSQLite3Statement
  • GetParamName() : wxSQLite3Statement
  • GetRowCount() : wxSQLite3Table
  • GetString() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetTable() : wxSQLite3Database
  • GetTime() : wxSQLite3Table, wxSQLite3ResultSet
  • GetTimestamp() : wxSQLite3ResultSet
  • GetVersion() : wxSQLite3Database

- i -

  • Interrupt() : wxSQLite3Database
  • IsNull() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • IsOpen() : wxSQLite3Database

- n -

  • NextRow() : wxSQLite3ResultSet

- o -

  • Open() : wxSQLite3Database
  • operator const char *() : wxSQLite3StatementBuffer
  • operator=() : wxSQLite3Statement, wxSQLite3Table, wxSQLite3ResultSet

- p -

  • PrepareStatement() : wxSQLite3Database

- r -

  • Reset() : wxSQLite3Statement
  • Rollback() : wxSQLite3Database
  • RollbackCallback() : wxSQLite3Hook

- s -

  • SetAuthorizer() : wxSQLite3Database
  • SetBusyTimeout() : wxSQLite3Database
  • SetCommitHook() : wxSQLite3Database
  • SetResult() : wxSQLite3FunctionContext
  • SetResultArg() : wxSQLite3FunctionContext
  • SetResultError() : wxSQLite3FunctionContext
  • SetResultNull() : wxSQLite3FunctionContext
  • SetRollbackHook() : wxSQLite3Database
  • SetRow() : wxSQLite3Table
  • SetUpdateHook() : wxSQLite3Database

- t -

  • TableExists() : wxSQLite3Database

- u -

  • UpdateCallback() : wxSQLite3Hook

- w -

  • wxAuthorizationCode : wxSQLite3Authorizer
  • wxAuthorizationResult : wxSQLite3Authorizer
  • wxSQLite3Database() : wxSQLite3Database
  • wxSQLite3Exception() : wxSQLite3Exception
  • wxSQLite3ResultSet() : wxSQLite3ResultSet
  • wxSQLite3Statement() : wxSQLite3Statement
  • wxSQLite3StatementBuffer() : wxSQLite3StatementBuffer
  • wxSQLite3Table() : wxSQLite3Table
  • wxUpdateType : wxSQLite3Hook

- ~ -

  • ~wxSQLite3AggregateFunction() : wxSQLite3AggregateFunction
  • ~wxSQLite3Authorizer() : wxSQLite3Authorizer
  • ~wxSQLite3Database() : wxSQLite3Database
  • ~wxSQLite3Exception() : wxSQLite3Exception
  • ~wxSQLite3Hook() : wxSQLite3Hook
  • ~wxSQLite3ResultSet() : wxSQLite3ResultSet
  • ~wxSQLite3ScalarFunction() : wxSQLite3ScalarFunction
  • ~wxSQLite3Statement() : wxSQLite3Statement
  • ~wxSQLite3StatementBuffer() : wxSQLite3StatementBuffer
  • ~wxSQLite3Table() : wxSQLite3Table


wxSqlite3: Class Members - Enumerations

  • All
  • Functions
  • Enumerations

  • wxAuthorizationCode : wxSQLite3Authorizer
  • wxAuthorizationResult : wxSQLite3Authorizer
  • wxUpdateType : wxSQLite3Hook


wxSqlite3: Class Members - Functions

  • All
  • Functions
  • Enumerations
  • a
  • b
  • c
  • e
  • f
  • g
  • i
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
  • ~

- a -

  • Aggregate() : wxSQLite3AggregateFunction
  • AuthorizationCodeToString() : wxSQLite3Authorizer
  • Authorize() : wxSQLite3Authorizer

- b -

  • Begin() : wxSQLite3Database
  • Bind() : wxSQLite3Statement
  • BindBool() : wxSQLite3Statement
  • BindDate() : wxSQLite3Statement
  • BindDateTime() : wxSQLite3Statement
  • BindNull() : wxSQLite3Statement
  • BindTime() : wxSQLite3Statement
  • BindTimestamp() : wxSQLite3Statement

- c -

  • CheckSyntax() : wxSQLite3Database
  • Clear() : wxSQLite3StatementBuffer
  • ClearBindings() : wxSQLite3Statement
  • Close() : wxSQLite3Database
  • Commit() : wxSQLite3Database
  • CommitCallback() : wxSQLite3Hook
  • CreateFunction() : wxSQLite3Database

- e -

  • Eof() : wxSQLite3ResultSet
  • ErrorCodeAsString() : wxSQLite3Exception
  • ExecAggregateFinalize() : wxSQLite3FunctionContext
  • ExecAggregateStep() : wxSQLite3FunctionContext
  • ExecAuthorizer() : wxSQLite3FunctionContext
  • ExecCommitHook() : wxSQLite3FunctionContext
  • ExecRollbackHook() : wxSQLite3FunctionContext
  • ExecScalarFunction() : wxSQLite3FunctionContext
  • ExecUpdateHook() : wxSQLite3FunctionContext
  • Execute() : wxSQLite3ScalarFunction
  • ExecuteQuery() : wxSQLite3Database, wxSQLite3Statement
  • ExecuteScalar() : wxSQLite3Database
  • ExecuteUpdate() : wxSQLite3Database, wxSQLite3Statement

- f -

  • Finalize() : wxSQLite3Statement, wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3AggregateFunction
  • FindColumnIndex() : wxSQLite3Table, wxSQLite3ResultSet
  • Format() : wxSQLite3StatementBuffer

- g -

  • GetAggregateCount() : wxSQLite3FunctionContext
  • GetAggregateStruct() : wxSQLite3FunctionContext
  • GetArgCount() : wxSQLite3FunctionContext
  • GetArgType() : wxSQLite3FunctionContext
  • GetAsString() : wxSQLite3Table, wxSQLite3ResultSet
  • GetAutoCommit() : wxSQLite3Database
  • GetBlob() : wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetBool() : wxSQLite3Table, wxSQLite3ResultSet
  • GetColumnCount() : wxSQLite3Table, wxSQLite3ResultSet
  • GetColumnName() : wxSQLite3Table, wxSQLite3ResultSet
  • GetColumnType() : wxSQLite3ResultSet
  • GetDate() : wxSQLite3Table, wxSQLite3ResultSet
  • GetDateTime() : wxSQLite3Table, wxSQLite3ResultSet
  • GetDeclaredColumnType() : wxSQLite3ResultSet
  • GetDouble() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetErrorCode() : wxSQLite3Exception
  • GetInt() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetInt64() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetLastRowId() : wxSQLite3Database
  • GetMessage() : wxSQLite3Exception
  • GetParamCount() : wxSQLite3Statement
  • GetParamIndex() : wxSQLite3Statement
  • GetParamName() : wxSQLite3Statement
  • GetRowCount() : wxSQLite3Table
  • GetString() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • GetTable() : wxSQLite3Database
  • GetTime() : wxSQLite3Table, wxSQLite3ResultSet
  • GetTimestamp() : wxSQLite3ResultSet
  • GetVersion() : wxSQLite3Database

- i -

  • Interrupt() : wxSQLite3Database
  • IsNull() : wxSQLite3Table, wxSQLite3ResultSet, wxSQLite3FunctionContext
  • IsOpen() : wxSQLite3Database

- n -

  • NextRow() : wxSQLite3ResultSet

- o -

  • Open() : wxSQLite3Database
  • operator const char *() : wxSQLite3StatementBuffer
  • operator=() : wxSQLite3Statement, wxSQLite3Table, wxSQLite3ResultSet

- p -

  • PrepareStatement() : wxSQLite3Database

- r -

  • Reset() : wxSQLite3Statement
  • Rollback() : wxSQLite3Database
  • RollbackCallback() : wxSQLite3Hook

- s -

  • SetAuthorizer() : wxSQLite3Database
  • SetBusyTimeout() : wxSQLite3Database
  • SetCommitHook() : wxSQLite3Database
  • SetResult() : wxSQLite3FunctionContext
  • SetResultArg() : wxSQLite3FunctionContext
  • SetResultError() : wxSQLite3FunctionContext
  • SetResultNull() : wxSQLite3FunctionContext
  • SetRollbackHook() : wxSQLite3Database
  • SetRow() : wxSQLite3Table
  • SetUpdateHook() : wxSQLite3Database

- t -

  • TableExists() : wxSQLite3Database

- u -

  • UpdateCallback() : wxSQLite3Hook

- w -

  • wxSQLite3Database() : wxSQLite3Database
  • wxSQLite3Exception() : wxSQLite3Exception
  • wxSQLite3ResultSet() : wxSQLite3ResultSet
  • wxSQLite3Statement() : wxSQLite3Statement
  • wxSQLite3StatementBuffer() : wxSQLite3StatementBuffer
  • wxSQLite3Table() : wxSQLite3Table

- ~ -

  • ~wxSQLite3AggregateFunction() : wxSQLite3AggregateFunction
  • ~wxSQLite3Authorizer() : wxSQLite3Authorizer
  • ~wxSQLite3Database() : wxSQLite3Database
  • ~wxSQLite3Exception() : wxSQLite3Exception
  • ~wxSQLite3Hook() : wxSQLite3Hook
  • ~wxSQLite3ResultSet() : wxSQLite3ResultSet
  • ~wxSQLite3ScalarFunction() : wxSQLite3ScalarFunction
  • ~wxSQLite3Statement() : wxSQLite3Statement
  • ~wxSQLite3StatementBuffer() : wxSQLite3StatementBuffer
  • ~wxSQLite3Table() : wxSQLite3Table


wxSqlite3: Class Members

  • File List
  • File Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Defines
Here is a list of all documented file members with links to the documentation:

  • ConvertStringToLongLong() : wxsqlite3.cpp
  • UTF8toWxString() : wxsqlite3.cpp
  • WXDLLIMPEXP_SQLITE3 : wxsqlite3def.h
  • wxERRMSG_BIND_BLOB : wxsqlite3.cpp
  • wxERRMSG_BIND_CLEAR : wxsqlite3.cpp
  • wxERRMSG_BIND_DATETIME : wxsqlite3.cpp
  • wxERRMSG_BIND_DBL : wxsqlite3.cpp
  • wxERRMSG_BIND_INT : wxsqlite3.cpp
  • wxERRMSG_BIND_INT64 : wxsqlite3.cpp
  • wxERRMSG_BIND_NULL : wxsqlite3.cpp
  • wxERRMSG_BIND_STR : wxsqlite3.cpp
  • wxERRMSG_DECODE : wxsqlite3.cpp
  • wxERRMSG_INVALID_INDEX : wxsqlite3.cpp
  • wxERRMSG_INVALID_NAME : wxsqlite3.cpp
  • wxERRMSG_INVALID_QUERY : wxsqlite3.cpp
  • wxERRMSG_INVALID_ROW : wxsqlite3.cpp
  • wxERRMSG_NODB : wxsqlite3.cpp
  • wxERRMSG_NOMEM : wxsqlite3.cpp
  • wxERRMSG_NORESULT : wxsqlite3.cpp
  • wxERRMSG_NOSTMT : wxsqlite3.cpp
  • wxSQLite3TransactionType : wxsqlite3.h
  • WXSQLITE_BLOB : wxsqlite3.h
  • WXSQLITE_ERROR : wxsqlite3.h
  • WXSQLITE_FLOAT : wxsqlite3.h
  • wxsqlite_int64 : wxsqlite3.h
  • WXSQLITE_INTEGER : wxsqlite3.h
  • WXSQLITE_NULL : wxsqlite3.h
  • WXSQLITE_TEXT : wxsqlite3.h
  • wxUSE_DYNAMIC_SQLITE3_LOAD : wxsqlite3def.h


wxSqlite3: Class Members

  • File List
  • File Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Defines

  • WXDLLIMPEXP_SQLITE3 : wxsqlite3def.h
  • WXSQLITE_BLOB : wxsqlite3.h
  • WXSQLITE_ERROR : wxsqlite3.h
  • WXSQLITE_FLOAT : wxsqlite3.h
  • WXSQLITE_INTEGER : wxsqlite3.h
  • WXSQLITE_NULL : wxsqlite3.h
  • WXSQLITE_TEXT : wxsqlite3.h
  • wxUSE_DYNAMIC_SQLITE3_LOAD : wxsqlite3def.h


wxSqlite3: Class Members

  • File List
  • File Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Defines

  • wxSQLite3TransactionType : wxsqlite3.h


wxSqlite3: Class Members

  • File List
  • File Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Defines

  • ConvertStringToLongLong() : wxsqlite3.cpp
  • UTF8toWxString() : wxsqlite3.cpp


wxSqlite3: Class Members

  • File List
  • File Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Defines

  • wxsqlite_int64 : wxsqlite3.h


wxSqlite3: Class Members

  • File List
  • File Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Defines

  • wxERRMSG_BIND_BLOB : wxsqlite3.cpp
  • wxERRMSG_BIND_CLEAR : wxsqlite3.cpp
  • wxERRMSG_BIND_DATETIME : wxsqlite3.cpp
  • wxERRMSG_BIND_DBL : wxsqlite3.cpp
  • wxERRMSG_BIND_INT : wxsqlite3.cpp
  • wxERRMSG_BIND_INT64 : wxsqlite3.cpp
  • wxERRMSG_BIND_NULL : wxsqlite3.cpp
  • wxERRMSG_BIND_STR : wxsqlite3.cpp
  • wxERRMSG_DECODE : wxsqlite3.cpp
  • wxERRMSG_INVALID_INDEX : wxsqlite3.cpp
  • wxERRMSG_INVALID_NAME : wxsqlite3.cpp
  • wxERRMSG_INVALID_QUERY : wxsqlite3.cpp
  • wxERRMSG_INVALID_ROW : wxsqlite3.cpp
  • wxERRMSG_NODB : wxsqlite3.cpp
  • wxERRMSG_NOMEM : wxsqlite3.cpp
  • wxERRMSG_NORESULT : wxsqlite3.cpp
  • wxERRMSG_NOSTMT : wxsqlite3.cpp


wxSqlite3: Hierarchical Index

wxSqlite3 Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:
  • wxSQLite3AggregateFunction
  • wxSQLite3Authorizer
  • wxSQLite3Database
  • wxSQLite3Exception
  • wxSQLite3FunctionContext
  • wxSQLite3Hook
  • wxSQLite3ResultSet
  • wxSQLite3ScalarFunction
  • wxSQLite3Statement
  • wxSQLite3StatementBuffer
  • wxSQLite3Table


wxSqlite3: C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp File Reference

  • File List
  • File Members

C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp File Reference

Implementation of the wxSQLite3 class. More...

#include "wx/wxprec.h"
#include "wx/wx.h"
#include "wx/wxSqlite/wxsqlite3.h"
#include "sqlite3.h"

Go to the source code of this file.

Functions

wxString | UTF8toWxString (const char *localValue)
wxLongLong | ConvertStringToLongLong (const wxString &str, wxLongLong defValue)

Variables

const wxChar * | wxERRMSG_NODB = _("No Database opened")
const wxChar * | wxERRMSG_NOSTMT = _("Statement not accessible")
const wxChar * | wxERRMSG_NOMEM = _("Out of memory")
const wxChar * | wxERRMSG_DECODE = _("Cannot decode binary")
const wxChar * | wxERRMSG_INVALID_INDEX = _("Invalid field index")
const wxChar * | wxERRMSG_INVALID_NAME = _("Invalid field name")
const wxChar * | wxERRMSG_INVALID_ROW = _("Invalid row index")
const wxChar * | wxERRMSG_INVALID_QUERY = _("Invalid scalar query")
const wxChar * | wxERRMSG_NORESULT = _("Null Results pointer")
const wxChar * | wxERRMSG_BIND_STR = _("Error binding string param")
const wxChar * | wxERRMSG_BIND_INT = _("Error binding int param")
const wxChar * | wxERRMSG_BIND_INT64 = _("Error binding int64 param")
const wxChar * | wxERRMSG_BIND_DBL = _("Error binding double param")
const wxChar * | wxERRMSG_BIND_BLOB = _("Error binding blob param")
const wxChar * | wxERRMSG_BIND_DATETIME = _("Error binding date/time param")
const wxChar * | wxERRMSG_BIND_NULL = _("Error binding NULL param")
const wxChar * | wxERRMSG_BIND_CLEAR = _("Error clearing bindings")

Detailed Description

Implementation of the wxSQLite3 class.

Definition in file wxsqlite3.cpp.

Generated on Fri Aug 4 12:22:56 2006 for wxSqlite3 by doxygen 1.4.6-NO


wxSqlite3: C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp Source File

  • File List
  • File Members

C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.cpp

Go to the documentation of this file.
00001
00002 // Name:        wxsqlite3.cpp
00003 // Purpose:     Implementation of wxSQLite3 classes
00004 // Author:      Ulrich Telle
00005 // Modified by:
00006 // Created:     2005-07-06
00007 // Copyright:   (c) Ulrich Telle
00008 // Licence:     wxWindows licence
00010
00012
00013 #if defined(__GNUG__) && !defined(__APPLE__)
00014 #pragma implementation "wxsqlite3.h"
00015 #endif
00016
00017 // For compilers that support precompilation, includes "wx/wx.h".
00018 #include "wx/wxprec.h"
00019
00020 #ifdef __BORLANDC__
00021 #pragma hdrstop
00022 #endif
00023
00024 #ifndef WX_PRECOMP
00025 #include "wx/wx.h"
00026 #endif
00027
00028 #include "wx/wxSqlite/wxsqlite3.h"
00029
00030 #include "sqlite3.h"
00031
00032 // Dynamic loading of the SQLite library
00033
00034 #if wxUSE_DYNAMIC_SQLITE3_LOAD
00035
00036 #include "wx/dynlib.h"
00037
00038 #define DYNFUNC(rcode, rtype, fname, farg, farguse) \
00039   typedef rtype (*p##fname) farg ; \
00040   static p##fname s_##fname = NULL;
00041 #include "wx/wxSqlite/wxsqlite3dyn.h"
00042 #undef DYNFUNC
00043
00044 static wxDynamicLibrary s_dll;
00045
00046 static void InitSQLite3DLL()
00047 {
00048   if (s_dll.IsLoaded())
00049   {
00050     return;
00051   }
00052
00053 #ifdef __WIN32__
00054         if (! s_dll.Load(wxT("sqlite3")))
00055 #else
00056         if (! s_dll.Load(wxT("libsqlite3")))
00057 #endif
00058   {
00059     throw wxSQLite3Exception(-1, wxT("error loading dynamic library"));
00060   }
00061
00062 #define DYNFUNC(rcode, rtype, fname, farg, farguse) \
00063   s_##fname = (p##fname) s_dll.GetSymbol(wxT(#fname));\
00064   if (! s_##fname)\
00065   {\
00066     s_dll.Unload();\
00067     throw wxSQLite3Exception(-1, wxT("error getting symbol <") wxT(#fname) wxT(">"));\
00068   }
00069 #include "wx/wxsqlite3dyn.h"
00070 #undef DYNFUNC
00071
00072 };
00073
00074 #define DYNFUNC(rcode, rtype, fname, farg, farguse) \
00075   rtype fname farg \
00076   {\
00077         InitSQLite3DLL();\
00078     rcode s_##fname farguse;\
00079   };
00080 #include "wx/wxsqlite3dyn.h"
00081 #undef DYNFUNC
00082
00083 #endif // wxUSE_DYNAMIC_SQLITE3_LOAD
00084
00085 // Error messages
00086
00087 const wxChar* wxERRMSG_NODB          = _("No Database opened");
00088 const wxChar* wxERRMSG_NOSTMT        = _("Statement not accessible");
00089 const wxChar* wxERRMSG_NOMEM         = _("Out of memory");
00090 const wxChar* wxERRMSG_DECODE        = _("Cannot decode binary");
00091 const wxChar* wxERRMSG_INVALID_INDEX = _("Invalid field index");
00092 const wxChar* wxERRMSG_INVALID_NAME  = _("Invalid field name");
00093 const wxChar* wxERRMSG_INVALID_ROW   = _("Invalid row index");
00094 const wxChar* wxERRMSG_INVALID_QUERY = _("Invalid scalar query");
00095
00096 const wxChar* wxERRMSG_NORESULT      = _("Null Results pointer");
00097 const wxChar* wxERRMSG_BIND_STR      = _("Error binding string param");
00098 const wxChar* wxERRMSG_BIND_INT      = _("Error binding int param");
00099 const wxChar* wxERRMSG_BIND_INT64    = _("Error binding int64 param");
00100 const wxChar* wxERRMSG_BIND_DBL      = _("Error binding double param");
00101 const wxChar* wxERRMSG_BIND_BLOB     = _("Error binding blob param");
00102 const wxChar* wxERRMSG_BIND_DATETIME = _("Error binding date/time param");
00103 const wxChar* wxERRMSG_BIND_NULL     = _("Error binding NULL param");
00104 const wxChar* wxERRMSG_BIND_CLEAR    = _("Error clearing bindings");
00105
00106 // ----------------------------------------------------------------------------
00107 // inline conversion from UTF8 strings to wxStringe
00108 // ----------------------------------------------------------------------------
00109
00110 inline wxString UTF8toWxString(const char* localValue)
00111 {
00112 #if wxUSE_UNICODE
00113   return wxString(localValue, wxConvUTF8);
00114 #else
00115   return wxString(wxConvUTF8.cMB2WC(localValue), *wxConvCurrent);
00116 #endif
00117 }
00118
00119 // ----------------------------------------------------------------------------
00120 // inline conversion from wxString to wxLongLong
00121 // ----------------------------------------------------------------------------
00122
00123 inline wxLongLong ConvertStringToLongLong(const wxString& str, wxLongLong defValue /*=0*/)
00124 {
00125   size_t n = str.Length();
00126   size_t j = 0;
00127         wxLongLong value = 0;
00128         bool negative = false;
00129
00130   if (str[j] == '-')
00131         {
00132                 negative = true;
00133                 j++;
00134         }
00135
00136         while (j < n)
00137         {
00138                 if (str[j] < '0' || str[j] > '9')
00139     {
00140                         return defValue;
00141     }
00142                 value *= 10;
00143                 value += (str[j] - '0');
00144                 j++;
00145         }
00146
00147         return negative ? -value : value;
00148 }
00149
00150 // ----------------------------------------------------------------------------
00151 // wxSQLite3Exception: class
00152 // ----------------------------------------------------------------------------
00153
00154 wxSQLite3Exception::wxSQLite3Exception(int errorCode, const wxString& errorMsg)
00155   : m_errorCode(errorCode)
00156 {
00157   m_errorMessage = ErrorCodeAsString(errorCode) + _T("[") +
00158                    wxString::Format(_T("%d"), errorCode) + _T("]: ") +
00159                    errorMsg;
00160 }
00161
00162 wxSQLite3Exception::wxSQLite3Exception(const wxSQLite3Exception&  e)
00163   : m_errorCode(e.m_errorCode), m_errorMessage(e.m_errorMessage)
00164 {
00165 }
00166
00167 const wxString wxSQLite3Exception::ErrorCodeAsString(int errorCode)
00168 {
00169   switch (errorCode)
00170   {
00171     case SQLITE_OK          : return _T("SQLITE_OK");
00172     case SQLITE_ERROR       : return _T("SQLITE_ERROR");
00173     case SQLITE_INTERNAL    : return _T("SQLITE_INTERNAL");
00174     case SQLITE_PERM        : return _T("SQLITE_PERM");
00175     case SQLITE_ABORT       : return _T("SQLITE_ABORT");
00176     case SQLITE_BUSY        : return _T("SQLITE_BUSY");
00177     case SQLITE_LOCKED      : return _T("SQLITE_LOCKED");
00178     case SQLITE_NOMEM       : return _T("SQLITE_NOMEM");
00179     case SQLITE_READONLY    : return _T("SQLITE_READONLY");
00180     case SQLITE_INTERRUPT   : return _T("SQLITE_INTERRUPT");
00181     case SQLITE_IOERR       : return _T("SQLITE_IOERR");
00182     case SQLITE_CORRUPT     : return _T("SQLITE_CORRUPT");
00183     case SQLITE_NOTFOUND    : return _T("SQLITE_NOTFOUND");
00184     case SQLITE_FULL        : return _T("SQLITE_FULL");
00185     case SQLITE_CANTOPEN    : return _T("SQLITE_CANTOPEN");
00186     case SQLITE_PROTOCOL    : return _T("SQLITE_PROTOCOL");
00187     case SQLITE_EMPTY       : return _T("SQLITE_EMPTY");
00188     case SQLITE_SCHEMA      : return _T("SQLITE_SCHEMA");
00189     case SQLITE_TOOBIG      : return _T("SQLITE_TOOBIG");
00190     case SQLITE_CONSTRAINT  : return _T("SQLITE_CONSTRAINT");
00191     case SQLITE_MISMATCH    : return _T("SQLITE_MISMATCH");
00192     case SQLITE_MISUSE      : return _T("SQLITE_MISUSE");
00193     case SQLITE_NOLFS       : return _T("SQLITE_NOLFS");
00194     case SQLITE_AUTH        : return _T("SQLITE_AUTH");
00195     case SQLITE_FORMAT      : return _T("SQLITE_FORMAT");
00196     case SQLITE_RANGE       : return _T("SQLITE_RANGE");
00197     case SQLITE_NOTADB      : return _T("SQLITE_NOTADB");
00198     case SQLITE_ROW         : return _T("SQLITE_ROW");
00199     case SQLITE_DONE        : return _T("SQLITE_DONE");
00200     case WXSQLITE_ERROR     : return _T("WXSQLITE_ERROR");
00201     default                 : return _T("UNKNOWN_ERROR");
00202   }
00203 }
00204
00205 wxSQLite3Exception::~wxSQLite3Exception()
00206 {
00207 }
00208
00209 // ----------------------------------------------------------------------------
00210 // wxSQLite3StatementBuffer: class providing a statement buffer
00211 //                           for use with the SQLite3 vmprintf function
00212 // ----------------------------------------------------------------------------
00213
00214 wxSQLite3StatementBuffer::wxSQLite3StatementBuffer()
00215 {
00216   m_buffer = 0;
00217 }
00218
00219 wxSQLite3StatementBuffer::~wxSQLite3StatementBuffer()
00220 {
00221   Clear();
00222 }
00223
00224 void wxSQLite3StatementBuffer::Clear()
00225 {
00226   if (m_buffer)
00227   {
00228     sqlite3_free(m_buffer);
00229     m_buffer = 0;
00230   }
00231
00232 }
00233
00234 const char* wxSQLite3StatementBuffer::Format(const char* format, ...)
00235 {
00236   Clear();
00237   va_list va;
00238   va_start(va, format);
00239   m_buffer = sqlite3_vmprintf(format, va);
00240   va_end(va);
00241   return m_buffer;
00242 }
00243
00244 // ----------------------------------------------------------------------------
00245 // wxSQLite3ResultSet: class providing access to the result set of a query
00246 // ----------------------------------------------------------------------------
00247
00248 wxSQLite3ResultSet::wxSQLite3ResultSet()
00249 {
00250   m_stmt = 0;
00251   m_eof = true;
00252   m_first = true;
00253   m_cols = 0;
00254   m_ownStmt = false;
00255 }
00256
00257 wxSQLite3ResultSet::wxSQLite3ResultSet(const wxSQLite3ResultSet& resultSet)
00258 {
00259   m_stmt = resultSet.m_stmt;
00260   // Only one object can own the statement
00261   const_cast<wxSQLite3ResultSet&>(resultSet).m_stmt = 0;
00262   m_eof = resultSet.m_eof;
00263   m_first = resultSet.m_first;
00264   m_cols = resultSet.m_cols;
00265   m_ownStmt = resultSet.m_ownStmt;
00266 }
00267
00268 wxSQLite3ResultSet::wxSQLite3ResultSet(void* db,
00269                                        void* stmt,
00270                                        bool eof,
00271                                        bool first,
00272                                        bool ownStmt /*=true*/)
00273 {
00274   m_db = db;
00275   m_stmt = stmt;
00276   m_eof = eof;
00277   m_first = first;
00278   m_cols = sqlite3_column_count((sqlite3_stmt*) m_stmt);
00279   m_ownStmt = ownStmt;
00280 }
00281
00282 wxSQLite3ResultSet::~wxSQLite3ResultSet()
00283 {
00284   try
00285   {
00286     Finalize();
00287   }
00288   catch (...)
00289   {
00290   }
00291 }
00292
00293 wxSQLite3ResultSet& wxSQLite3ResultSet::operator=(const wxSQLite3ResultSet& resultSet)
00294 {
00295   try
00296   {
00297     Finalize();
00298   }
00299   catch (...)
00300   {
00301   }
00302   m_stmt = resultSet.m_stmt;
00303   // Only one object can own the statement
00304   const_cast<wxSQLite3ResultSet&>(resultSet).m_stmt = 0;
00305   m_eof = resultSet.m_eof;
00306   m_first = resultSet.m_first;
00307   m_cols = resultSet.m_cols;
00308   m_ownStmt = resultSet.m_ownStmt;
00309   return *this;
00310 }
00311
00312 int wxSQLite3ResultSet::GetColumnCount()
00313 {
00314   CheckStmt();
00315   return m_cols;
00316 }
00317
00318 wxString wxSQLite3ResultSet::GetAsString(int columnIndex)
00319 {
00320   CheckStmt();
00321
00322   if (columnIndex < 0 || columnIndex > m_cols-1)
00323   {
00324     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00325   }
00326
00327   const char* localValue = (const char*) sqlite3_column_text((sqlite3_stmt*) m_stmt, columnIndex);
00328   return UTF8toWxString(localValue);
00329 }
00330
00331 wxString wxSQLite3ResultSet::GetAsString(const wxString& columnName)
00332 {
00333   int columnIndex = FindColumnIndex(columnName);
00334   const char* localValue = (const char*) sqlite3_column_text((sqlite3_stmt*) m_stmt, columnIndex);
00335   return UTF8toWxString(localValue);
00336 }
00337
00338 int wxSQLite3ResultSet::GetInt(int columnIndex, int nullValue /* = 0 */)
00339 {
00340   if (GetColumnType(columnIndex) == SQLITE_NULL)
00341   {
00342     return nullValue;
00343   }
00344   else
00345   {
00346     return sqlite3_column_int((sqlite3_stmt*) m_stmt, columnIndex);
00347   }
00348 }
00349
00350
00351 int wxSQLite3ResultSet::GetInt(const wxString& columnName, int nullValue /* = 0 */)
00352 {
00353   int columnIndex = FindColumnIndex(columnName);
00354   return GetInt(columnIndex, nullValue);
00355 }
00356
00357 wxLongLong wxSQLite3ResultSet::GetInt64(int columnIndex, wxLongLong nullValue /* = 0 */)
00358 {
00359   if (GetColumnType(columnIndex) == SQLITE_NULL)
00360   {
00361     return nullValue;
00362   }
00363   else
00364   {
00365     return wxLongLong(sqlite3_column_int64((sqlite3_stmt*) m_stmt, columnIndex));
00366   }
00367 }
00368
00369 wxLongLong wxSQLite3ResultSet::GetInt64(const wxString& columnName, wxLongLong nullValue /* = 0 */)
00370 {
00371   int columnIndex = FindColumnIndex(columnName);
00372   return GetInt64(columnIndex, nullValue);
00373 }
00374
00375 double wxSQLite3ResultSet::GetDouble(int columnIndex, double nullValue /* = 0.0 */)
00376 {
00377   if (GetColumnType(columnIndex) == SQLITE_NULL)
00378   {
00379     return nullValue;
00380   }
00381   else
00382   {
00383     return sqlite3_column_double((sqlite3_stmt*) m_stmt, columnIndex);
00384   }
00385 }
00386
00387 double wxSQLite3ResultSet::GetDouble(const wxString& columnName, double nullValue /* = 0.0 */)
00388 {
00389   int columnIndex = FindColumnIndex(columnName);
00390   return GetDouble(columnIndex, nullValue);
00391 }
00392
00393 wxString wxSQLite3ResultSet::GetString(int columnIndex, const wxString& nullValue /* = wxEmptyString */)
00394 {
00395   if (GetColumnType(columnIndex) == SQLITE_NULL)
00396   {
00397     return nullValue;
00398   }
00399   else
00400   {
00401     const char* localValue = (const char*) sqlite3_column_text((sqlite3_stmt*) m_stmt, columnIndex);
00402     return UTF8toWxString(localValue);
00403   }
00404 }
00405
00406 wxString wxSQLite3ResultSet::GetString(const wxString& columnName, const wxString& nullValue /* = wxEmptyString */)
00407 {
00408   int columnIndex = FindColumnIndex(columnName);
00409   return GetString(columnIndex, nullValue);
00410 }
00411
00412 const unsigned char* wxSQLite3ResultSet::GetBlob(int columnIndex, int& len)
00413 {
00414   CheckStmt();
00415
00416   if (columnIndex < 0 || columnIndex > m_cols-1)
00417   {
00418     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00419   }
00420
00421   len = sqlite3_column_bytes((sqlite3_stmt*) m_stmt, columnIndex);
00422   return (const unsigned char*) sqlite3_column_blob((sqlite3_stmt*) m_stmt, columnIndex);
00423 }
00424
00425 const unsigned char* wxSQLite3ResultSet::GetBlob(const wxString& columnName, int& len)
00426 {
00427   int columnIndex = FindColumnIndex(columnName);
00428   return GetBlob(columnIndex, len);
00429 }
00430
00431
00432 wxDateTime wxSQLite3ResultSet::GetDate(int columnIndex)
00433 {
00434   if (GetColumnType(columnIndex) == SQLITE_NULL)
00435   {
00436     return wxInvalidDateTime;
00437   }
00438   else
00439   {
00440     wxDateTime date;
00441     if (date.ParseDate(GetString(columnIndex)) != NULL)
00442     {
00443       return date;
00444     }
00445     else
00446     {
00447       return wxInvalidDateTime;
00448     }
00449   }
00450 }
00451
00452 wxDateTime wxSQLite3ResultSet::GetDate(const wxString& columnName)
00453 {
00454   int columnIndex = FindColumnIndex(columnName);
00455   return GetDate(columnIndex);
00456 }
00457
00458
00459 wxDateTime wxSQLite3ResultSet::GetTime(int columnIndex)
00460 {
00461   if (GetColumnType(columnIndex) == SQLITE_NULL)
00462   {
00463     return wxInvalidDateTime;
00464   }
00465   else
00466   {
00467     wxDateTime date;
00468     if (date.ParseTime(GetString(columnIndex)) != NULL)
00469     {
00470       return date;
00471     }
00472     else
00473     {
00474       return wxInvalidDateTime;
00475     }
00476   }
00477 }
00478
00479 wxDateTime wxSQLite3ResultSet::GetTime(const wxString& columnName)
00480 {
00481   int columnIndex = FindColumnIndex(columnName);
00482   return GetTime(columnIndex);
00483 }
00484
00485 wxDateTime wxSQLite3ResultSet::GetDateTime(int columnIndex)
00486 {
00487   if (GetColumnType(columnIndex) == SQLITE_NULL)
00488   {
00489     return wxInvalidDateTime;
00490   }
00491   else
00492   {
00493     wxDateTime date;
00494     if (date.ParseDateTime(GetString(columnIndex)) != NULL)
00495     {
00496       date.SetMillisecond(0);
00497       return date;
00498     }
00499     else
00500     {
00501       return wxInvalidDateTime;
00502     }
00503   }
00504 }
00505
00506 wxDateTime wxSQLite3ResultSet::GetDateTime(const wxString& columnName)
00507 {
00508   int columnIndex = FindColumnIndex(columnName);
00509   return GetDateTime(columnIndex);
00510 }
00511
00512 wxDateTime wxSQLite3ResultSet::GetTimestamp(int columnIndex)
00513 {
00514   if (GetColumnType(columnIndex) == SQLITE_NULL)
00515   {
00516     return wxInvalidDateTime;
00517   }
00518   else
00519   {
00520     wxDateTime date;
00521     if (date.ParseDateTime(GetString(columnIndex)) != NULL)
00522     {
00523       return date;
00524     }
00525     else
00526     {
00527       return wxInvalidDateTime;
00528     }
00529   }
00530 }
00531
00532 wxDateTime wxSQLite3ResultSet::GetTimestamp(const wxString& columnName)
00533 {
00534   int columnIndex = FindColumnIndex(columnName);
00535   return GetTimestamp(columnIndex);
00536 }
00537
00538 bool wxSQLite3ResultSet::GetBool(int columnIndex)
00539 {
00540   return GetInt(columnIndex) != 0;
00541 }
00542
00543 bool wxSQLite3ResultSet::GetBool(const wxString& columnName)
00544 {
00545   int columnIndex = FindColumnIndex(columnName);
00546   return GetBool(columnIndex);
00547 }
00548
00549 bool wxSQLite3ResultSet::IsNull(int columnIndex)
00550 {
00551   return (GetColumnType(columnIndex) == SQLITE_NULL);
00552 }
00553
00554 bool wxSQLite3ResultSet::IsNull(const wxString& columnName)
00555 {
00556   int columnIndex = FindColumnIndex(columnName);
00557   return (GetColumnType(columnIndex) == SQLITE_NULL);
00558 }
00559
00560 int wxSQLite3ResultSet::FindColumnIndex(const wxString& columnName)
00561 {
00562   CheckStmt();
00563
00564   wxCharBuffer strColumnName = wxConvUTF8.cWC2MB(columnName.wc_str(*wxConvCurrent));
00565   const char* localColumnName = strColumnName;
00566
00567   if (columnName.Len() > 0)
00568   {
00569     for (int columnIndex = 0; columnIndex < m_cols; columnIndex++)
00570     {
00571       const char* temp = sqlite3_column_name((sqlite3_stmt*) m_stmt, columnIndex);
00572
00573       if (strcmp(localColumnName, temp) == 0)
00574       {
00575         return columnIndex;
00576       }
00577     }
00578   }
00579
00580   throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00581 }
00582
00583 wxString wxSQLite3ResultSet::GetColumnName(int columnIndex)
00584 {
00585   CheckStmt();
00586
00587   if (columnIndex < 0 || columnIndex > m_cols-1)
00588   {
00589     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00590   }
00591
00592   const char* localValue = sqlite3_column_name((sqlite3_stmt*) m_stmt, columnIndex);
00593   return UTF8toWxString(localValue);
00594 }
00595
00596 wxString wxSQLite3ResultSet::GetDeclaredColumnType(int columnIndex)
00597 {
00598   CheckStmt();
00599
00600   if (columnIndex < 0 || columnIndex > m_cols-1)
00601   {
00602     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00603   }
00604
00605   const char* localValue = sqlite3_column_decltype((sqlite3_stmt*) m_stmt, columnIndex);
00606   return UTF8toWxString(localValue);
00607 }
00608
00609 int wxSQLite3ResultSet::GetColumnType(int columnIndex)
00610 {
00611   CheckStmt();
00612
00613   if (columnIndex < 0 || columnIndex > m_cols-1)
00614   {
00615     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00616   }
00617
00618   return sqlite3_column_type((sqlite3_stmt*) m_stmt, columnIndex);
00619 }
00620
00621 bool wxSQLite3ResultSet::Eof()
00622 {
00623   CheckStmt();
00624   return m_eof;
00625 }
00626
00627 bool wxSQLite3ResultSet::NextRow()
00628 {
00629   CheckStmt();
00630
00631   int rc;
00632   if (m_first)
00633   {
00634     m_first = false;
00635     rc = (m_eof) ? SQLITE_DONE : SQLITE_ROW;
00636   }
00637   else
00638   {
00639     rc = sqlite3_step((sqlite3_stmt*) m_stmt);
00640   }
00641
00642   if (rc == SQLITE_DONE) // no more rows
00643   {
00644     m_eof = true;
00645     return false;
00646   }
00647   else if (rc == SQLITE_ROW) // more rows
00648   {
00649     return true;
00650   }
00651   else
00652   {
00653     rc = sqlite3_finalize((sqlite3_stmt*) m_stmt);
00654     m_stmt = 0;
00655     const char* localError = sqlite3_errmsg((sqlite3*) m_db);
00656     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
00657   }
00658 }
00659
00660 void wxSQLite3ResultSet::Finalize()
00661 {
00662   if (m_stmt && m_ownStmt)
00663   {
00664     int rc = sqlite3_finalize((sqlite3_stmt*) m_stmt);
00665     m_stmt = 0;
00666     if (rc != SQLITE_OK)
00667     {
00668       const char* localError = sqlite3_errmsg((sqlite3*) m_db);
00669       throw wxSQLite3Exception(rc, UTF8toWxString(localError));
00670     }
00671   }
00672 }
00673
00674 void wxSQLite3ResultSet::CheckStmt()
00675 {
00676   if (m_stmt == 0)
00677   {
00678     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_NOSTMT);
00679   }
00680 }
00681
00682 #ifdef WXSQLITE3_HAVE_METADATA
00683
00684 wxString wxSQLite3ResultSet::GetDatabaseName(int columnIndex)
00685 {
00686   CheckStmt();
00687   if (columnIndex < 0 || columnIndex > m_cols-1)
00688   {
00689     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00690   }
00691
00692   const char* localValue = sqlite3_column_database_name((sqlite3_stmt*) m_stmt, columnIndex);
00693   if (localValue != NULL)
00694     return UTF8toWxString(localValue);
00695   else
00696     return wxEmptyString;
00697 }
00698
00699 wxString wxSQLite3ResultSet::GetTableName(int columnIndex)
00700 {
00701   CheckStmt();
00702   if (columnIndex < 0 || columnIndex > m_cols-1)
00703   {
00704     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00705   }
00706
00707   const char* localValue = sqlite3_column_table_name((sqlite3_stmt*) m_stmt, columnIndex);
00708   if (localValue != NULL)
00709     return UTF8toWxString(localValue);
00710   else
00711     return wxEmptyString;
00712 }
00713
00714 wxString wxSQLite3ResultSet::GetOriginName(int columnIndex)
00715 {
00716   CheckStmt();
00717   if (columnIndex < 0 || columnIndex > m_cols-1)
00718   {
00719     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00720   }
00721
00722   const char* localValue = sqlite3_column_origin_name((sqlite3_stmt*) m_stmt, columnIndex);
00723   if (localValue != NULL)
00724     return UTF8toWxString(localValue);
00725   else
00726     return wxEmptyString;
00727 }
00728
00729 #endif
00730
00731 // ----------------------------------------------------------------------------
00732 // wxSQLite3Table: class holding the complete result set of a query
00733 // ----------------------------------------------------------------------------
00734
00735 wxSQLite3Table::wxSQLite3Table()
00736 {
00737   m_results = 0;
00738   m_rows = 0;
00739   m_cols = 0;
00740   m_currentRow = 0;
00741 }
00742
00743 wxSQLite3Table::wxSQLite3Table(const wxSQLite3Table& table)
00744 {
00745   m_results = table.m_results;
00746   // Only one object can own the results
00747   const_cast<wxSQLite3Table&>(table).m_results = 0;
00748   m_rows = table.m_rows;
00749   m_cols = table.m_cols;
00750   m_currentRow = table.m_currentRow;
00751 }
00752
00753 wxSQLite3Table::wxSQLite3Table(char** results, int rows, int cols)
00754 {
00755   m_results = results;
00756   m_rows = rows;
00757   m_cols = cols;
00758   m_currentRow = 0;
00759 }
00760
00761 wxSQLite3Table::~wxSQLite3Table()
00762 {
00763   try
00764   {
00765     Finalize();
00766   }
00767   catch (...)
00768   {
00769   }
00770 }
00771
00772 wxSQLite3Table& wxSQLite3Table::operator=(const wxSQLite3Table& table)
00773 {
00774   try
00775   {
00776     Finalize();
00777   }
00778   catch (...)
00779   {
00780   }
00781   m_results = table.m_results;
00782   // Only one object can own the results
00783   const_cast<wxSQLite3Table&>(table).m_results = 0;
00784   m_rows = table.m_rows;
00785   m_cols = table.m_cols;
00786   m_currentRow = table.m_currentRow;
00787   return *this;
00788 }
00789
00790 void wxSQLite3Table::Finalize()
00791 {
00792   if (m_results)
00793   {
00794     sqlite3_free_table(m_results);
00795     m_results = 0;
00796   }
00797 }
00798
00799 int wxSQLite3Table::GetColumnCount()
00800 {
00801   CheckResults();
00802   return m_cols;
00803 }
00804
00805 int wxSQLite3Table::GetRowCount()
00806 {
00807   CheckResults();
00808   return m_rows;
00809 }
00810
00811 int wxSQLite3Table::FindColumnIndex(const wxString& columnName)
00812 {
00813   CheckResults();
00814
00815   wxCharBuffer strColumnName = wxConvUTF8.cWC2MB(columnName.wc_str(*wxConvCurrent));
00816   const char* localColumnName = strColumnName;
00817
00818   if (columnName.Len() > 0)
00819   {
00820     for (int columnIndex = 0; columnIndex < m_cols; columnIndex++)
00821     {
00822       if (strcmp(localColumnName, m_results[columnIndex]) == 0)
00823       {
00824         return columnIndex;
00825       }
00826     }
00827   }
00828
00829   throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_NAME);
00830 }
00831
00832 wxString wxSQLite3Table::GetAsString(int columnIndex)
00833 {
00834   if (columnIndex < 0 || columnIndex > m_cols-1)
00835   {
00836     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
00837   }
00838
00839   int nIndex = (m_currentRow*m_cols) + m_cols + columnIndex;
00840   const char* localValue = m_results[nIndex];
00841   return UTF8toWxString(localValue);
00842 }
00843
00844 wxString wxSQLite3Table::GetAsString(const wxString& columnName)
00845 {
00846   int index = FindColumnIndex(columnName);
00847   return GetAsString(index);
00848 }
00849
00850 int wxSQLite3Table::GetInt(int columnIndex, int nullValue /* = 0 */)
00851 {
00852   if (IsNull(columnIndex))
00853   {
00854     return nullValue;
00855   }
00856   else
00857   {
00858     long value = nullValue;
00859     GetAsString(columnIndex).ToLong(&value);
00860     return (int) value;
00861   }
00862 }
00863
00864 int wxSQLite3Table::GetInt(const wxString& columnName, int nullValue /* = 0 */)
00865 {
00866   if (IsNull(columnName))
00867   {
00868     return nullValue;
00869   }
00870   else
00871   {
00872     long value = nullValue;
00873     GetAsString(columnName).ToLong(&value);
00874     return (int) value;
00875   }
00876 }
00877
00878 wxLongLong wxSQLite3Table::GetInt64(int columnIndex, wxLongLong nullValue /* = 0 */)
00879 {
00880   if (IsNull(columnIndex))
00881   {
00882     return nullValue;
00883   }
00884   else
00885   {
00886     return ConvertStringToLongLong(GetAsString(columnIndex), nullValue);
00887   }
00888 }
00889
00890 wxLongLong wxSQLite3Table::GetInt64(const wxString& columnName, wxLongLong nullValue /* = 0 */)
00891 {
00892   if (IsNull(columnName))
00893   {
00894     return nullValue;
00895   }
00896   else
00897   {
00898     return ConvertStringToLongLong(GetAsString(columnName), nullValue);
00899   }
00900 }
00901
00902 double wxSQLite3Table::GetDouble(int columnIndex, double nullValue /* = 0.0 */)
00903 {
00904   if (IsNull(columnIndex))
00905   {
00906     return nullValue;
00907   }
00908   else
00909   {
00910     double value = nullValue;
00911     GetAsString(columnIndex).ToDouble(&value);
00912     return value;
00913   }
00914 }
00915
00916 double wxSQLite3Table::GetDouble(const wxString& columnName, double nullValue /* = 0.0 */)
00917 {
00918   if (IsNull(columnName))
00919   {
00920     return nullValue;
00921   }
00922   else
00923   {
00924     double value = nullValue;
00925     GetAsString(columnName).ToDouble(&value);
00926     return value;
00927   }
00928 }
00929
00930 wxString wxSQLite3Table::GetString(int columnIndex, const wxString& nullValue /* = wxEmptyString */)
00931 {
00932   if (IsNull(columnIndex))
00933   {
00934     return nullValue;
00935   }
00936   else
00937   {
00938     return GetAsString(columnIndex);
00939   }
00940 }
00941
00942 wxString wxSQLite3Table::GetString(const wxString& columnName, const wxString& nullValue /* = wxEmptyString */)
00943 {
00944   if (IsNull(columnName))
00945   {
00946     return nullValue;
00947   }
00948   else
00949   {
00950     return GetAsString(columnName);
00951   }
00952 }
00953
00954 wxDateTime wxSQLite3Table::GetDate(int columnIndex)
00955 {
00956   wxDateTime date;
00957   if (date.ParseDate(GetString(columnIndex)) != NULL)
00958   {
00959     return date;
00960   }
00961   else
00962   {
00963     return wxInvalidDateTime;
00964   }
00965 }
00966
00967 wxDateTime wxSQLite3Table::GetDate(const wxString& columnName)
00968 {
00969   int columnIndex = FindColumnIndex(columnName);
00970   return GetDate(columnIndex);
00971 }
00972
00973 wxDateTime wxSQLite3Table::GetTime(int columnIndex)
00974 {
00975   wxDateTime date;
00976   if (date.ParseTime(GetString(columnIndex)) != NULL)
00977   {
00978     return date;
00979   }
00980   else
00981   {
00982     return wxInvalidDateTime;
00983   }
00984 }
00985
00986 wxDateTime wxSQLite3Table::GetTime(const wxString& columnName)
00987 {
00988   int columnIndex = FindColumnIndex(columnName);
00989   return GetTime(columnIndex);
00990 }
00991
00992 wxDateTime wxSQLite3Table::GetDateTime(int columnIndex)
00993 {
00994   wxDateTime date;
00995   if (date.ParseDateTime(GetString(columnIndex)) != NULL)
00996   {
00997     return date;
00998   }
00999   else
01000   {
01001     return wxInvalidDateTime;
01002   }
01003 }
01004
01005 wxDateTime wxSQLite3Table::GetDateTime(const wxString& columnName)
01006 {
01007   int columnIndex = FindColumnIndex(columnName);
01008   return GetDateTime(columnIndex);
01009 }
01010
01011 bool wxSQLite3Table::GetBool(int columnIndex)
01012 {
01013   return GetInt(columnIndex) != 0;
01014 }
01015
01016 bool wxSQLite3Table::GetBool(const wxString& columnName)
01017 {
01018   int columnIndex = FindColumnIndex(columnName);
01019   return GetBool(columnIndex);
01020 }
01021
01022 bool wxSQLite3Table::IsNull(int columnIndex)
01023 {
01024   CheckResults();
01025
01026   if (columnIndex < 0 || columnIndex > m_cols-1)
01027   {
01028     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
01029   }
01030
01031   int index = (m_currentRow*m_cols) + m_cols + columnIndex;
01032   const char* localValue = m_results[index];
01033   return (localValue == 0);
01034 }
01035
01036 bool wxSQLite3Table::IsNull(const wxString& columnName)
01037 {
01038   int index = FindColumnIndex(columnName);
01039   return IsNull(index);
01040 }
01041
01042 wxString wxSQLite3Table::GetColumnName(int columnIndex)
01043 {
01044   CheckResults();
01045
01046   if (columnIndex < 0 || columnIndex > m_cols-1)
01047   {
01048     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_INDEX);
01049   }
01050
01051   const char* localValue = m_results[columnIndex];
01052   return UTF8toWxString(localValue);
01053 }
01054
01055 void wxSQLite3Table::SetRow(int row)
01056 {
01057   CheckResults();
01058
01059   if (row < 0 || row > m_rows-1)
01060   {
01061     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_ROW);
01062   }
01063
01064   m_currentRow = row;
01065 }
01066
01067 void wxSQLite3Table::CheckResults()
01068 {
01069   if (m_results == 0)
01070   {
01071     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_NORESULT);
01072   }
01073 }
01074
01075 // ----------------------------------------------------------------------------
01076 // wxSQLite3Statement: class holding a prepared statement
01077 // ----------------------------------------------------------------------------
01078
01079 wxSQLite3Statement::wxSQLite3Statement()
01080 {
01081   m_db = 0;
01082   m_stmt = 0;
01083 }
01084
01085 wxSQLite3Statement::wxSQLite3Statement(const wxSQLite3Statement& statement)
01086 {
01087   m_db = statement.m_db;
01088   m_stmt = statement.m_stmt;
01089   // Only one object can own prepared statement
01090   const_cast<wxSQLite3Statement&>(statement).m_stmt = 0;
01091 }
01092
01093 wxSQLite3Statement::wxSQLite3Statement(void* db, void* stmt)
01094 {
01095   m_db = db;
01096   m_stmt = stmt;
01097 }
01098
01099 wxSQLite3Statement::~wxSQLite3Statement()
01100 {
01101   try
01102   {
01103     Finalize();
01104   }
01105   catch (...)
01106   {
01107   }
01108 }
01109
01110 wxSQLite3Statement& wxSQLite3Statement::operator=(const wxSQLite3Statement& statement)
01111 {
01112   m_db = statement.m_db;
01113   m_stmt = statement.m_stmt;
01114   // Only one object can own prepared statement
01115   const_cast<wxSQLite3Statement&>(statement).m_stmt = 0;
01116   return *this;
01117 }
01118
01119 int wxSQLite3Statement::ExecuteUpdate()
01120 {
01121   CheckDatabase();
01122   CheckStmt();
01123
01124   const char* localError=0;
01125
01126   int rc = sqlite3_step((sqlite3_stmt*) m_stmt);
01127
01128   if (rc == SQLITE_DONE)
01129   {
01130     int rowsChanged = sqlite3_changes((sqlite3*) m_db);
01131
01132     rc = sqlite3_reset((sqlite3_stmt*) m_stmt);
01133
01134     if (rc != SQLITE_OK)
01135     {
01136       localError = sqlite3_errmsg((sqlite3*) m_db);
01137       throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01138     }
01139
01140     return rowsChanged;
01141   }
01142   else
01143   {
01144     rc = sqlite3_reset((sqlite3_stmt*) m_stmt);
01145     localError = sqlite3_errmsg((sqlite3*) m_db);
01146     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01147   }
01148 }
01149
01150 wxSQLite3ResultSet wxSQLite3Statement::ExecuteQuery()
01151 {
01152   CheckDatabase();
01153   CheckStmt();
01154
01155   int rc = sqlite3_step((sqlite3_stmt*) m_stmt);
01156
01157   if (rc == SQLITE_DONE)  // no more rows
01158   {
01159     return wxSQLite3ResultSet(m_db, m_stmt, true/*eof*/, true/*first*/, false);
01160   }
01161   else if (rc == SQLITE_ROW)  // one or more rows
01162   {
01163     return wxSQLite3ResultSet(m_db, m_stmt, false/*eof*/, true/*first*/, false);
01164   }
01165   else
01166   {
01167     rc = sqlite3_reset((sqlite3_stmt*) m_stmt);
01168     const char* localError = sqlite3_errmsg((sqlite3*) m_db);
01169     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01170   }
01171 }
01172
01173 int wxSQLite3Statement::GetParamCount()
01174 {
01175   CheckStmt();
01176   return sqlite3_bind_parameter_count((sqlite3_stmt*) m_stmt);
01177 }
01178
01179 int wxSQLite3Statement::GetParamIndex(const wxString& paramName)
01180 {
01181   CheckStmt();
01182
01183   wxCharBuffer strParamName = wxConvUTF8.cWC2MB(paramName.wc_str(*wxConvCurrent));
01184   const char* localParamName = strParamName;
01185
01186   return sqlite3_bind_parameter_index((sqlite3_stmt*) m_stmt, localParamName);
01187 }
01188
01189 wxString wxSQLite3Statement::GetParamName(int paramIndex)
01190 {
01191   CheckStmt();
01192   const char* localParamName = sqlite3_bind_parameter_name((sqlite3_stmt*) m_stmt, paramIndex);
01193   return UTF8toWxString(localParamName);
01194 }
01195
01196 void wxSQLite3Statement::Bind(int paramIndex, const wxString& stringValue)
01197 {
01198   CheckStmt();
01199
01200   wxCharBuffer strStringValue = wxConvUTF8.cWC2MB(stringValue.wc_str(*wxConvCurrent));
01201   const char* localStringValue = strStringValue;
01202
01203   int rc = sqlite3_bind_text((sqlite3_stmt*) m_stmt, paramIndex, localStringValue, -1, SQLITE_TRANSIENT);
01204
01205   if (rc != SQLITE_OK)
01206   {
01207     throw wxSQLite3Exception(rc, wxERRMSG_BIND_STR);
01208   }
01209 }
01210
01211 void wxSQLite3Statement::Bind(int paramIndex, int intValue)
01212 {
01213   CheckStmt();
01214   int rc = sqlite3_bind_int((sqlite3_stmt*) m_stmt, paramIndex, intValue);
01215
01216   if (rc != SQLITE_OK)
01217   {
01218     throw wxSQLite3Exception(rc, wxERRMSG_BIND_INT);
01219   }
01220 }
01221
01222 void wxSQLite3Statement::Bind(int paramIndex, wxLongLong int64Value)
01223 {
01224   CheckStmt();
01225   int rc = sqlite3_bind_int64((sqlite3_stmt*) m_stmt, paramIndex, int64Value.GetValue());
01226
01227   if (rc != SQLITE_OK)
01228   {
01229     throw wxSQLite3Exception(rc, wxERRMSG_BIND_INT64);
01230   }
01231 }
01232
01233 void wxSQLite3Statement::Bind(int paramIndex, double doubleValue)
01234 {
01235   CheckStmt();
01236   int rc = sqlite3_bind_double((sqlite3_stmt*) m_stmt, paramIndex, doubleValue);
01237
01238   if (rc != SQLITE_OK)
01239   {
01240     throw wxSQLite3Exception(rc, wxERRMSG_BIND_DBL);
01241   }
01242 }
01243
01244 void wxSQLite3Statement::Bind(int paramIndex, const char* charValue)
01245 {
01246   CheckStmt();
01247   int rc = sqlite3_bind_text((sqlite3_stmt*) m_stmt, paramIndex, charValue, -1, SQLITE_TRANSIENT);
01248
01249   if (rc != SQLITE_OK)
01250   {
01251     throw wxSQLite3Exception(rc, wxERRMSG_BIND_STR);
01252   }
01253 }
01254
01255 void wxSQLite3Statement::Bind(int paramIndex, const unsigned char* blobValue, int blobLen)
01256 {
01257   CheckStmt();
01258   int rc = sqlite3_bind_blob((sqlite3_stmt*) m_stmt, paramIndex,
01259                 (const void*)blobValue, blobLen, SQLITE_TRANSIENT);
01260
01261   if (rc != SQLITE_OK)
01262   {
01263     throw wxSQLite3Exception(rc, wxERRMSG_BIND_BLOB);
01264   }
01265 }
01266
01267 void wxSQLite3Statement::BindDate(int paramIndex, const wxDateTime& date)
01268 {
01269   if (date.IsValid())
01270   {
01271     Bind(paramIndex,date.FormatISODate());
01272   }
01273   else
01274   {
01275     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_BIND_DATETIME);
01276   }
01277 }
01278
01279 void wxSQLite3Statement::BindTime(int paramIndex, const wxDateTime& time)
01280 {
01281   if (time.IsValid())
01282   {
01283     Bind(paramIndex,time.FormatISOTime());
01284   }
01285   else
01286   {
01287     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_BIND_DATETIME);
01288   }
01289 }
01290
01291 void wxSQLite3Statement::BindDateTime(int paramIndex, const wxDateTime& datetime)
01292 {
01293   if (datetime.IsValid())
01294   {
01295     Bind(paramIndex,datetime.Format(_T("%Y-%m-%d %H:%M:%S")));
01296   }
01297   else
01298   {
01299     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_BIND_DATETIME);
01300   }
01301 }
01302
01303 void wxSQLite3Statement::BindTimestamp(int paramIndex, const wxDateTime& timestamp)
01304 {
01305   if (timestamp.IsValid())
01306   {
01307     Bind(paramIndex,timestamp.Format(_T("%Y-%m-%d %H:%M:%S.%l")));
01308   }
01309   else
01310   {
01311     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_BIND_DATETIME);
01312   }
01313 }
01314
01315 void wxSQLite3Statement::BindBool(int paramIndex, bool value)
01316 {
01317   Bind(paramIndex, value ? 1 : 0);
01318 }
01319
01320 void wxSQLite3Statement::BindNull(int paramIndex)
01321 {
01322   CheckStmt();
01323   int rc = sqlite3_bind_null((sqlite3_stmt*) m_stmt, paramIndex);
01324
01325   if (rc != SQLITE_OK)
01326   {
01327     throw wxSQLite3Exception(rc, wxERRMSG_BIND_NULL);
01328   }
01329 }
01330
01331 void wxSQLite3Statement::ClearBindings()
01332 {
01333   CheckStmt();
01334 #if 0 // missing in SQLite DLL
01335   int rc = sqlite3_clear_bindings((sqlite3_stmt*) m_stmt);
01336
01337   if (rc != SQLITE_OK)
01338   {
01339     throw wxSQLite3Exception(rc, wxERRMSG_BIND_CLEAR);
01340   }
01341 #else
01342   for (int paramIndex = 1; paramIndex <= GetParamCount(); paramIndex++)
01343   {
01344     BindNull(paramIndex);
01345   }
01346 #endif
01347 }
01348
01349 void wxSQLite3Statement::Reset()
01350 {
01351   if (m_stmt)
01352   {
01353     int rc = sqlite3_reset((sqlite3_stmt*) m_stmt);
01354
01355     if (rc != SQLITE_OK)
01356     {
01357       const char* localError = sqlite3_errmsg((sqlite3*) m_db);
01358       throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01359     }
01360   }
01361 }
01362
01363 void wxSQLite3Statement::Finalize()
01364 {
01365   if (m_stmt)
01366   {
01367     int rc = sqlite3_finalize((sqlite3_stmt*) m_stmt);
01368     m_stmt = 0;
01369
01370     if (rc != SQLITE_OK)
01371     {
01372       const char* localError = sqlite3_errmsg((sqlite3*) m_db);
01373       throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01374     }
01375   }
01376 }
01377
01378 void wxSQLite3Statement::CheckDatabase()
01379 {
01380   if (m_db == 0)
01381   {
01382     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_NODB);
01383   }
01384 }
01385
01386 void wxSQLite3Statement::CheckStmt()
01387 {
01388   if (m_stmt == 0)
01389   {
01390     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_NOSTMT);
01391   }
01392 }
01393
01394 // ----------------------------------------------------------------------------
01395 // wxSQLite3Database: class holding a SQLite3 database object
01396 // ----------------------------------------------------------------------------
01397
01398 wxSQLite3Database::wxSQLite3Database()
01399 {
01400   m_db = 0;
01401   m_busyTimeoutMs = 60000; // 60 seconds
01402 }
01403
01404 wxSQLite3Database::wxSQLite3Database(const wxSQLite3Database& db)
01405 {
01406   m_db = db.m_db;
01407   m_busyTimeoutMs = 60000; // 60 seconds
01408 }
01409
01410 wxSQLite3Database::~wxSQLite3Database()
01411 {
01412   Close();
01413 }
01414
01415 wxSQLite3Database& wxSQLite3Database::operator=(const wxSQLite3Database& db)
01416 {
01417   m_db = db.m_db;
01418   m_busyTimeoutMs = 60000; // 60 seconds
01419   return *this;
01420 }
01421
01422 void wxSQLite3Database::Open(const wxString& fileName)
01423 {
01424   wxCharBuffer strFileName = wxConvUTF8.cWC2MB(fileName.wc_str(*wxConvCurrent));
01425   const char* localFileName = strFileName;
01426
01427   int rc = sqlite3_open((const char*) localFileName, (sqlite3**) &m_db);
01428
01429   if (rc != SQLITE_OK)
01430   {
01431     const char* localError = sqlite3_errmsg((sqlite3*) m_db);
01432     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01433   }
01434
01435   SetBusyTimeout(m_busyTimeoutMs);
01436 }
01437
01438 bool wxSQLite3Database::IsOpen()
01439 {
01440   return (m_db != NULL);
01441 }
01442
01443 void wxSQLite3Database::Close()
01444 {
01445   if (m_db)
01446   {
01447     sqlite3_close((sqlite3*) m_db);
01448     m_db = 0;
01449   }
01450 }
01451
01452 void wxSQLite3Database::Begin(wxSQLite3TransactionType transactionType)
01453 {
01454   wxString sql;
01455   switch (transactionType)
01456   {
01457     case WXSQLITE_TRANSACTION_DEFERRED:
01458       sql << _T("begin deferred transaction");
01459       break;
01460     case WXSQLITE_TRANSACTION_IMMEDIATE:
01461       sql << _T("begin immediate transaction");
01462       break;
01463     case WXSQLITE_TRANSACTION_EXCLUSIVE:
01464       sql << _T("begin immediate transaction");
01465       break;
01466     default:
01467       sql << _T("begin transaction");
01468       break;
01469   }
01470   ExecuteUpdate(sql);
01471 }
01472
01473 void wxSQLite3Database::Commit()
01474 {
01475   ExecuteUpdate("commit transaction");
01476 }
01477
01478 void wxSQLite3Database::Rollback()
01479 {
01480   ExecuteUpdate("rollback transaction");
01481 }
01482
01483 bool wxSQLite3Database::GetAutoCommit()
01484 {
01485   CheckDatabase();
01486   return sqlite3_get_autocommit((sqlite3*) m_db) != 0;
01487 }
01488
01489 wxSQLite3Statement wxSQLite3Database::PrepareStatement(const wxString& sql)
01490 {
01491   wxCharBuffer strSql = wxConvUTF8.cWC2MB(sql.wc_str(*wxConvCurrent));
01492   const char* localSql = strSql;
01493   return PrepareStatement(localSql);
01494 }
01495
01496 wxSQLite3Statement wxSQLite3Database::PrepareStatement(const wxSQLite3StatementBuffer& sql)
01497 {
01498   return PrepareStatement((const char*) sql);
01499 }
01500
01501 wxSQLite3Statement wxSQLite3Database::PrepareStatement(const char* sql)
01502 {
01503   CheckDatabase();
01504   sqlite3_stmt* stmt = (sqlite3_stmt*) Prepare(sql);
01505   return wxSQLite3Statement(m_db, stmt);
01506 }
01507
01508 bool wxSQLite3Database::TableExists(const wxString& tableName)
01509 {
01510   wxString sql;
01511   sql << _T("select count(*) from sqlite_master where type='table' and name='") << tableName << _T("'");
01512   int rc = ExecuteScalar(sql);
01513   return (rc > 0);
01514 }
01515
01516 bool wxSQLite3Database::CheckSyntax(const wxString& sql)
01517 {
01518   wxCharBuffer strSql = wxConvUTF8.cWC2MB(sql.wc_str(*wxConvCurrent));
01519   const char* localSql = strSql;
01520   return CheckSyntax(localSql);
01521 }
01522
01523 bool wxSQLite3Database::CheckSyntax(const wxSQLite3StatementBuffer& sql)
01524 {
01525   return CheckSyntax((const char*) sql);
01526 }
01527
01528 bool wxSQLite3Database::CheckSyntax(const char* sql)
01529 {
01530   return sqlite3_complete(sql) != 0;
01531 }
01532
01533 int wxSQLite3Database::ExecuteUpdate(const wxString& sql)
01534 {
01535   wxCharBuffer strSql = wxConvUTF8.cWC2MB(sql.wc_str(*wxConvCurrent));
01536   const char* localSql = strSql;
01537   return ExecuteUpdate(localSql);
01538 }
01539
01540 int wxSQLite3Database::ExecuteUpdate(const wxSQLite3StatementBuffer& sql)
01541 {
01542   return ExecuteUpdate((const char*) sql);
01543 }
01544
01545 int wxSQLite3Database::ExecuteUpdate(const char* sql)
01546 {
01547   CheckDatabase();
01548
01549   char* localError=0;
01550
01551   int rc = sqlite3_exec((sqlite3*) m_db, sql, 0, 0, &localError);
01552
01553   if (rc == SQLITE_OK)
01554   {
01555     return sqlite3_changes((sqlite3*) m_db);
01556   }
01557   else
01558   {
01559     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01560   }
01561 }
01562
01563 wxSQLite3ResultSet wxSQLite3Database::ExecuteQuery(const wxString& sql)
01564 {
01565   wxCharBuffer strSql = wxConvUTF8.cWC2MB(sql.wc_str(*wxConvCurrent));
01566   const char* localSql = strSql;
01567   return ExecuteQuery(localSql);
01568 }
01569
01570 wxSQLite3ResultSet wxSQLite3Database::ExecuteQuery(const wxSQLite3StatementBuffer& sql)
01571 {
01572   return ExecuteQuery((const char*) sql);
01573 }
01574
01575 wxSQLite3ResultSet wxSQLite3Database::ExecuteQuery(const char* sql)
01576 {
01577   CheckDatabase();
01578
01579   sqlite3_stmt* stmt = (sqlite3_stmt*) Prepare(sql);
01580
01581   int rc = sqlite3_step(stmt);
01582
01583   if (rc == SQLITE_DONE) // no rows
01584   {
01585     return wxSQLite3ResultSet(m_db, stmt, true /* eof */);
01586   }
01587   else if (rc == SQLITE_ROW) // one or more rows
01588   {
01589     return wxSQLite3ResultSet(m_db, stmt, false /* eof */);
01590   }
01591   else
01592   {
01593     rc = sqlite3_finalize(stmt);
01594     const char* localError= sqlite3_errmsg((sqlite3*) m_db);
01595     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01596   }
01597 }
01598
01599 int wxSQLite3Database::ExecuteScalar(const wxString& sql)
01600 {
01601   wxCharBuffer strSql = wxConvUTF8.cWC2MB(sql.wc_str(*wxConvCurrent));
01602   const char* localSql = strSql;
01603   return ExecuteScalar(localSql);
01604 }
01605
01606 int wxSQLite3Database::ExecuteScalar(const wxSQLite3StatementBuffer& sql)
01607 {
01608   return ExecuteScalar((const char*) sql);
01609 }
01610
01611 int wxSQLite3Database::ExecuteScalar(const char* sql)
01612 {
01613   wxSQLite3ResultSet resultSet = ExecuteQuery(sql);
01614
01615   if (resultSet.Eof() || resultSet.GetColumnCount() < 1)
01616   {
01617     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_INVALID_QUERY);
01618   }
01619
01620   long value = 0;
01621   resultSet.GetAsString(0).ToLong(&value);
01622   return value;
01623 }
01624
01625 wxSQLite3Table wxSQLite3Database::GetTable(const wxString& sql)
01626 {
01627   wxCharBuffer strSql = wxConvUTF8.cWC2MB(sql.wc_str(*wxConvCurrent));
01628   const char* localSql = strSql;
01629   return GetTable(localSql);
01630 }
01631
01632 wxSQLite3Table wxSQLite3Database::GetTable(const wxSQLite3StatementBuffer& sql)
01633 {
01634   return GetTable((const char*) sql);
01635 }
01636
01637 wxSQLite3Table wxSQLite3Database::GetTable(const char* sql)
01638 {
01639   CheckDatabase();
01640
01641   char* localError=0;
01642   char** results=0;
01643   int rc;
01644   int rows(0);
01645   int cols(0);
01646
01647   rc = sqlite3_get_table((sqlite3*) m_db, sql, &results, &rows, &cols, &localError);
01648
01649   if (rc == SQLITE_OK)
01650   {
01651     return wxSQLite3Table(results, rows, cols);
01652   }
01653   else
01654   {
01655     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01656   }
01657 }
01658
01659 wxLongLong wxSQLite3Database::GetLastRowId()
01660 {
01661   return wxLongLong(sqlite3_last_insert_rowid((sqlite3*) m_db));
01662 }
01663
01664 void wxSQLite3Database::Interrupt()
01665 {
01666   sqlite3_interrupt((sqlite3*) m_db);
01667 }
01668
01669 void wxSQLite3Database::SetBusyTimeout(int nMillisecs)
01670 {
01671   m_busyTimeoutMs = nMillisecs;
01672   sqlite3_busy_timeout((sqlite3*) m_db, m_busyTimeoutMs);
01673 }
01674
01675 wxString wxSQLite3Database::GetVersion()
01676 {
01677   return UTF8toWxString(sqlite3_libversion());
01678 }
01679
01680 bool wxSQLite3Database::CreateFunction(const wxString& funcName, int argCount, wxSQLite3ScalarFunction& function)
01681 {
01682   CheckDatabase();
01683   wxCharBuffer strFuncName = wxConvUTF8.cWC2MB(funcName.wc_str(*wxConvCurrent));
01684   const char* localFuncName = strFuncName;
01685   int rc = sqlite3_create_function((sqlite3*) m_db, localFuncName, argCount,
01686                                    SQLITE_UTF8, &function,
01687                                    (void (*)(sqlite3_context*,int,sqlite3_value**)) wxSQLite3FunctionContext::ExecScalarFunction, NULL, NULL);
01688   return rc == SQLITE_OK;
01689 }
01690
01691 bool wxSQLite3Database::CreateFunction(const wxString& funcName, int argCount, wxSQLite3AggregateFunction& function)
01692 {
01693   CheckDatabase();
01694   wxCharBuffer strFuncName = wxConvUTF8.cWC2MB(funcName.wc_str(*wxConvCurrent));
01695   const char* localFuncName = strFuncName;
01696   int rc = sqlite3_create_function((sqlite3*) m_db, localFuncName, argCount,
01697                                    SQLITE_UTF8, &function,
01698                                    NULL,
01699                                    (void (*)(sqlite3_context*,int,sqlite3_value**)) wxSQLite3FunctionContext::ExecAggregateStep,
01700                                    (void (*)(sqlite3_context*)) wxSQLite3FunctionContext::ExecAggregateFinalize);
01701   return rc == SQLITE_OK;
01702 }
01703
01704 bool wxSQLite3Database::SetAuthorizer(wxSQLite3Authorizer& authorizer)
01705 {
01706   CheckDatabase();
01707   int rc = sqlite3_set_authorizer((sqlite3*) m_db, wxSQLite3FunctionContext::ExecAuthorizer, &authorizer);
01708   return rc == SQLITE_OK;
01709 }
01710
01711 void wxSQLite3Database::SetCommitHook(wxSQLite3Hook* commitHook)
01712 {
01713   CheckDatabase();
01714   if (commitHook)
01715   {
01716     sqlite3_commit_hook((sqlite3*) m_db, (int(*)(void*)) wxSQLite3FunctionContext::ExecCommitHook, commitHook);
01717   }
01718   else
01719   {
01720     sqlite3_commit_hook((sqlite3*) m_db, (int(*)(void*)) NULL, NULL);
01721   }
01722 }
01723
01724 void wxSQLite3Database::SetRollbackHook(wxSQLite3Hook* rollbackHook)
01725 {
01726   CheckDatabase();
01727   if (rollbackHook)
01728   {
01729     sqlite3_rollback_hook((sqlite3*) m_db, (void(*)(void*)) wxSQLite3FunctionContext::ExecRollbackHook, rollbackHook);
01730   }
01731   else
01732   {
01733     sqlite3_rollback_hook((sqlite3*) m_db, (void(*)(void*)) NULL, NULL);
01734   }
01735 }
01736
01737 void wxSQLite3Database::SetUpdateHook(wxSQLite3Hook* updateHook)
01738 {
01739   CheckDatabase();
01740   if (updateHook)
01741   {
01742     sqlite3_update_hook((sqlite3*) m_db, (void(*)(void*,int,const char*,const char*, wxsqlite_int64)) wxSQLite3FunctionContext::ExecUpdateHook, updateHook);
01743   }
01744   else
01745   {
01746     sqlite3_update_hook((sqlite3*) m_db, (void(*)(void*,int,const char*,const char*, wxsqlite_int64)) NULL, NULL);
01747   }
01748 }
01749
01750 void wxSQLite3Database::CheckDatabase()
01751 {
01752   if (!m_db)
01753   {
01754     throw wxSQLite3Exception(WXSQLITE_ERROR, wxERRMSG_NODB);
01755   }
01756 }
01757
01758 void* wxSQLite3Database::Prepare(const char* sql)
01759 {
01760   CheckDatabase();
01761
01762   const char* tail=0;
01763   sqlite3_stmt* stmt;
01764
01765   int rc = sqlite3_prepare((sqlite3*) m_db, sql, -1, &stmt, &tail);
01766
01767   if (rc != SQLITE_OK)
01768   {
01769     const char* localError = sqlite3_errmsg((sqlite3*) m_db);
01770     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01771   }
01772
01773   return stmt;
01774 }
01775
01776 #ifdef WXSQLITE3_HAVE_METADATA
01777
01778 void wxSQLite3Database::GetMetaData(const wxString& databaseName, const wxString& tableName, const wxString& columnName,
01779                                     wxString* dataType, bool* notNull, bool* primaryKey, bool* autoIncrement)
01780 {
01781   wxCharBuffer strDatabaseName = wxConvUTF8.cWC2MB(databaseName.wc_str(*wxConvCurrent));
01782   const char* localDatabaseName = strDatabaseName;
01783   if (databaseName == wxEmptyString) localDatabaseName = NULL;
01784   wxCharBuffer strTableName = wxConvUTF8.cWC2MB(tableName.wc_str(*wxConvCurrent));
01785   const char* localTableName = strTableName;
01786   wxCharBuffer strColumnName = wxConvUTF8.cWC2MB(columnName.wc_str(*wxConvCurrent));
01787   const char* localColumnName = strColumnName;
01788   const char* localDataType;
01789   int localNotNull;
01790   int localPrimaryKey;
01791   int localAutoIncrement;
01792   int rc = sqlite3_table_column_metadata((sqlite3*) m_db, localDatabaseName, localTableName, localColumnName,
01793                                          &localDataType, NULL, &localNotNull, &localPrimaryKey, &localAutoIncrement);
01794
01795   if (rc != SQLITE_OK)
01796   {
01797     const char* localError = sqlite3_errmsg((sqlite3*) m_db);
01798     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
01799   }
01800
01801   if (dataType != NULL) *dataType = UTF8toWxString(localDataType);
01802   {
01803   }
01804   if (notNull       != NULL) *notNull       = (localNotNull       != 0);
01805   if (primaryKey    != NULL) *primaryKey    = (localPrimaryKey    != 0);
01806   if (autoIncrement != NULL) *autoIncrement = (localAutoIncrement != 0);
01807 }
01808
01809 #endif
01810
01811 // ----------------------------------------------------------------------------
01812 // wxSQLite3FunctionContext: class providing the function context
01813 //                           for user defined functions
01814 // ----------------------------------------------------------------------------
01815
01816 int wxSQLite3FunctionContext::GetArgCount()
01817 {
01818   return m_argc;
01819 }
01820
01821 int wxSQLite3FunctionContext::GetArgType(int argIndex)
01822 {
01823   if (argIndex >= 0 && argIndex < m_argc)
01824   {
01825     return sqlite3_value_type((sqlite3_value*) m_argv[argIndex]);
01826   }
01827   else
01828   {
01829     return SQLITE_NULL;
01830   }
01831 }
01832
01833 bool wxSQLite3FunctionContext::IsNull(int argIndex)
01834 {
01835   if (argIndex >= 0 && argIndex < m_argc)
01836   {
01837     return sqlite3_value_type((sqlite3_value*) m_argv[argIndex]) == SQLITE_NULL;
01838   }
01839   else
01840   {
01841     return true;
01842   }
01843 }
01844
01845 int wxSQLite3FunctionContext::GetInt(int argIndex, int nullValue)
01846 {
01847   if (argIndex >= 0 && argIndex < m_argc)
01848   {
01849     if (!IsNull(argIndex))
01850     {
01851       return sqlite3_value_int((sqlite3_value*) m_argv[argIndex]);
01852     }
01853     else
01854     {
01855       return nullValue;
01856     }
01857   }
01858   else
01859   {
01860     return nullValue;
01861   }
01862 }
01863
01864 wxLongLong wxSQLite3FunctionContext::GetInt64(int argIndex, wxLongLong nullValue)
01865 {
01866   if (argIndex >= 0 && argIndex < m_argc)
01867   {
01868     if (!IsNull(argIndex))
01869     {
01870       return wxLongLong(sqlite3_value_int64((sqlite3_value*) m_argv[argIndex]));
01871     }
01872     else
01873     {
01874       return nullValue;
01875     }
01876   }
01877   else
01878   {
01879     return nullValue;
01880   }
01881 }
01882
01883 double wxSQLite3FunctionContext::GetDouble(int argIndex, double nullValue)
01884 {
01885   if (argIndex >= 0 && argIndex < m_argc)
01886   {
01887     if (!IsNull(argIndex))
01888     {
01889       return sqlite3_value_double((sqlite3_value*) m_argv[argIndex]);
01890     }
01891     else
01892     {
01893       return nullValue;
01894     }
01895   }
01896   else
01897   {
01898     return nullValue;
01899   }
01900 }
01901
01902 wxString wxSQLite3FunctionContext::GetString(int argIndex, const wxString& nullValue)
01903 {
01904   if (argIndex >= 0 && argIndex < m_argc)
01905   {
01906     if (!IsNull(argIndex))
01907     {
01908       const char* localValue = (const char*) sqlite3_value_text((sqlite3_value*) m_argv[argIndex]);
01909       return UTF8toWxString(localValue);
01910     }
01911     else
01912     {
01913       return nullValue;
01914     }
01915   }
01916   else
01917   {
01918     return nullValue;
01919   }
01920 }
01921
01922 const unsigned char* wxSQLite3FunctionContext::GetBlob(int argIndex, int& len)
01923 {
01924   if (argIndex >= 0 && argIndex < m_argc)
01925   {
01926     if (!IsNull(argIndex))
01927     {
01928       len = sqlite3_value_bytes((sqlite3_value*) m_argv[argIndex]);
01929       return (const unsigned char*)sqlite3_value_blob((sqlite3_value*) m_argv[argIndex]);
01930     }
01931     else
01932     {
01933       return NULL;
01934     }
01935   }
01936   else
01937   {
01938     return NULL;
01939   }
01940 }
01941
01942 void wxSQLite3FunctionContext::SetResult(int value)
01943 {
01944   sqlite3_result_int((sqlite3_context*) m_ctx, value);
01945 }
01946
01947 void wxSQLite3FunctionContext::SetResult(wxLongLong value)
01948 {
01949   sqlite3_result_int64((sqlite3_context*) m_ctx, value.GetValue());
01950 }
01951
01952 void wxSQLite3FunctionContext::SetResult(double value)
01953 {
01954   sqlite3_result_double((sqlite3_context*) m_ctx, value);
01955 }
01956
01957 void wxSQLite3FunctionContext::SetResult(const wxString& value)
01958 {
01959   wxCharBuffer strValue = wxConvUTF8.cWC2MB(value.wc_str(*wxConvCurrent));
01960   const char* localValue = strValue;
01961   sqlite3_result_text((sqlite3_context*) m_ctx, localValue, -1, SQLITE_TRANSIENT);
01962 }
01963
01964 void wxSQLite3FunctionContext::SetResult(unsigned char* value, int len)
01965 {
01966   sqlite3_result_blob((sqlite3_context*) m_ctx, value, len, SQLITE_TRANSIENT);
01967 }
01968
01969 void wxSQLite3FunctionContext::SetResultNull()
01970 {
01971   sqlite3_result_null((sqlite3_context*) m_ctx);
01972 }
01973
01974 void wxSQLite3FunctionContext::SetResultArg(int argIndex)
01975 {
01976   if (argIndex >= 0 && argIndex < m_argc) {
01977     sqlite3_result_value((sqlite3_context*) m_ctx, (sqlite3_value*) m_argv[argIndex]);
01978   } else {
01979     sqlite3_result_null((sqlite3_context*) m_ctx);
01980   }
01981 }
01982
01983 void wxSQLite3FunctionContext::SetResultError(const wxString& errmsg)
01984 {
01985   wxCharBuffer strErrmsg = wxConvUTF8.cWC2MB(errmsg.wc_str(*wxConvCurrent));
01986   const char* localErrmsg = strErrmsg;
01987   sqlite3_result_error((sqlite3_context*) m_ctx, localErrmsg, -1);
01988 }
01989
01990 int wxSQLite3FunctionContext::GetAggregateCount()
01991 {
01992   if (m_isAggregate)
01993   {
01994     return sqlite3_aggregate_count((sqlite3_context*) m_ctx);
01995   }
01996   else
01997   {
01998     return 0;
01999   }
02000 }
02001
02002 void* wxSQLite3FunctionContext::GetAggregateStruct(int len)
02003 {
02004   if (m_isAggregate)
02005   {
02006     return sqlite3_aggregate_context((sqlite3_context*) m_ctx, len);
02007   }
02008   else
02009   {
02010     return NULL;
02011   }
02012 }
02013
02014 /* static */
02015 void wxSQLite3FunctionContext::ExecScalarFunction(void* ctx, int argc, void** argv)
02016 {
02017   wxSQLite3FunctionContext context(ctx, false, argc, argv);
02018   wxSQLite3ScalarFunction* func = (wxSQLite3ScalarFunction*) sqlite3_user_data((sqlite3_context*) ctx);
02019   func->Execute(context);
02020 }
02021
02022 /* static */
02023 void wxSQLite3FunctionContext::ExecAggregateStep(void* ctx, int argc, void** argv)
02024 {
02025   wxSQLite3FunctionContext context(ctx, true, argc, argv);
02026   wxSQLite3AggregateFunction* func = (wxSQLite3AggregateFunction*) sqlite3_user_data((sqlite3_context*) ctx);
02027   func->Aggregate(context);
02028 }
02029
02030 /* static */
02031 void wxSQLite3FunctionContext::ExecAggregateFinalize(void* ctx)
02032 {
02033   wxSQLite3FunctionContext context(ctx, true, 0, NULL);
02034   wxSQLite3AggregateFunction* func = (wxSQLite3AggregateFunction*) sqlite3_user_data((sqlite3_context*) ctx);
02035   func->Finalize(context);
02036 }
02037
02038 /* static */
02039 int wxSQLite3FunctionContext::ExecAuthorizer(void* func, int type,
02040                                              const char* arg1, const char* arg2,
02041                                              const char* arg3, const char* arg4)
02042 {
02043 #if wxUSE_UNICODE
02044   wxString locArg1(arg1, wxConvUTF8);
02045   wxString locArg2(arg2, wxConvUTF8);
02046   wxString locArg3(arg3, wxConvUTF8);
02047   wxString locArg4(arg4, wxConvUTF8);
02048 #else
02049   wxString locArg1(wxConvUTF8.cMB2WC(arg1), *wxConvCurrent);
02050   wxString locArg2(wxConvUTF8.cMB2WC(arg2), *wxConvCurrent);
02051   wxString locArg3(wxConvUTF8.cMB2WC(arg3), *wxConvCurrent);
02052   wxString locArg4(wxConvUTF8.cMB2WC(arg4), *wxConvCurrent);
02053 #endif
02054   wxSQLite3Authorizer::wxAuthorizationCode localType = (wxSQLite3Authorizer::wxAuthorizationCode) type;
02055   return (int) ((wxSQLite3Authorizer*) func)->Authorize(localType, locArg1, locArg2, locArg3, locArg3);
02056 }
02057
02058 /* static */
02059 int wxSQLite3FunctionContext::ExecCommitHook(void* hook)
02060 {
02061   return (int) ((wxSQLite3Hook*) hook)->CommitCallback();
02062 }
02063
02064 /* static */
02065 void wxSQLite3FunctionContext::ExecRollbackHook(void* hook)
02066 {
02067   ((wxSQLite3Hook*) hook)->RollbackCallback();
02068 }
02069
02070 /* static */
02071 void wxSQLite3FunctionContext::ExecUpdateHook(void* hook, int type,
02072                                               const char* database, const char* table,
02073                                               wxsqlite_int64 rowid)
02074 {
02075 #if wxUSE_UNICODE
02076   wxString locDatabase(database, wxConvUTF8);
02077   wxString locTable(table, wxConvUTF8);
02078 #else
02079   wxString locDatabase(wxConvUTF8.cMB2WC(database), *wxConvCurrent);
02080   wxString locTable(wxConvUTF8.cMB2WC(table), *wxConvCurrent);
02081 #endif
02082   wxSQLite3Hook::wxUpdateType locType = (wxSQLite3Hook::wxUpdateType) type;
02083   wxLongLong locRowid = rowid;
02084   ((wxSQLite3Hook*) hook)->UpdateCallback(locType, locDatabase, locTable, locRowid);
02085 }
02086
02087 wxSQLite3FunctionContext::wxSQLite3FunctionContext(void* ctx, bool isAggregate, int argc, void** argv)
02088 : m_ctx(ctx), m_isAggregate(isAggregate), m_argc(argc), m_argv(argv)
02089 {
02090 }
02091
02092 static wxChar* authCodeString[] =
02093 { _T("SQLITE_COPY"),              _T("SQLITE_CREATE_INDEX"),      _T("SQLITE_CREATE_TABLE"),
02094   _T("SQLITE_CREATE_TEMP_INDEX"), _T("SQLITE_CREATE_TEMP_TABLE"), _T("SQLITE_CREATE_TEMP_TRIGGER"),
02095   _T("SQLITE_CREATE_TEMP_VIEW"),  _T("SQLITE_CREATE_TRIGGER"),    _T("SQLITE_CREATE_VIEW"),
02096   _T("SQLITE_DELETE"),            _T("SQLITE_DROP_INDEX"),        _T("SQLITE_DROP_TABLE"),
02097   _T("SQLITE_DROP_TEMP_INDEX"),   _T("SQLITE_DROP_TEMP_TABLE"),   _T("SQLITE_DROP_TEMP_TRIGGER"),
02098   _T("SQLITE_DROP_TEMP_VIEW"),    _T("SQLITE_DROP_TRIGGER"),      _T("SQLITE_DROP_VIEW"),
02099   _T("SQLITE_INSERT"),            _T("SQLITE_PRAGMA"),            _T("SQLITE_READ"),
02100   _T("SQLITE_SELECT"),            _T("SQLITE_TRANSACTION"),       _T("SQLITE_UPDATE"),
02101   _T("SQLITE_ATTACH"),            _T("SQLITE_DETACH"),            _T("SQLITE_ALTER_TABLE"),
02102   _T("SQLITE_REINDEX"),           _T("SQLITE_ANALYZE")
02103 };
02104
02105
02106 /* static */
02107 wxString wxSQLite3Authorizer::AuthorizationCodeToString(wxSQLite3Authorizer::wxAuthorizationCode type)
02108 {
02109   wxChar* authString = _T("Unknown");
02110   if (type >= SQLITE_COPY && type <= SQLITE_MAX_CODE)
02111   {
02112     authString = authCodeString[type];
02113   }
02114   return wxString(authString);
02115 }
Generated on Fri Aug 4 12:22:56 2006 for wxSqlite3 by doxygen 1.4.6-NO


wxSqlite3: C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h File Reference

  • File List
  • File Members

C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h File Reference

Interface of the wxSQLite3 class. More...

#include <wx/datetime.h>
#include "wx/wxSqlite/wxsqlite3def.h"

Go to the source code of this file.

Classes

class | wxSQLite3Exception
SQL exception. More...
class | wxSQLite3StatementBuffer
SQL statment buffer for use with SQLite3's printf method. More...
class | wxSQLite3FunctionContext
Context for user defined scalar or aggregate functions. More...
class | wxSQLite3ScalarFunction
Interface for user defined scalar functions. More...
class | wxSQLite3AggregateFunction
Interface for user defined aggregate functions. More...
class | wxSQLite3Authorizer
Interface for a user defined authorizer function. More...
class | wxSQLite3Hook
Interface for a user defined hook function. More...
class | wxSQLite3ResultSet
Result set of a SQL query. More...
class | wxSQLite3Table
Holds the complete result set of a SQL query. More...
class | wxSQLite3Statement
Represents a prepared SQL statement. More...
class | wxSQLite3Database
Represents a SQLite3 database object. More...

Defines

#define | WXSQLITE_ERROR 1000
#define | WXSQLITE_INTEGER 1
#define | WXSQLITE_FLOAT 2
#define | WXSQLITE_TEXT 3
#define | WXSQLITE_BLOB 4
#define | WXSQLITE_NULL 5

Typedefs

typedef long long int | wxsqlite_int64

Enumerations

enum | wxSQLite3TransactionType

Detailed Description

Interface of the wxSQLite3 class.

Definition in file wxsqlite3.h.


wxSqlite3: C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h Source File

  • File List
  • File Members

C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3.h

Go to the documentation of this file.
00001
00002 // Name:        wxsqlite3.h
00003 // Purpose:     wxWidgets wrapper around the SQLite3 embedded database library.
00004 // Author:      Ulrich Telle
00005 // Modified by:
00006 // Created:     2005-07-14
00007 // Copyright:   (c) Ulrich Telle
00008 // Licence:     wxWindows licence
00010
00012
00013 #ifndef _WX_SQLITE3_H_
00014 #define _WX_SQLITE3_H_
00015
00016 #if defined(__GNUG__) && !defined(__APPLE__)
00017     #pragma interface "wxsqlite3.h"
00018 #endif
00019
00020 #include <wx/datetime.h>
00021
00022 #include "wx/wxSqlite/wxsqlite3def.h"
00023
00024 #define WXSQLITE_ERROR 1000
00025
00026 #define WXSQLITE_INTEGER  1
00027 #define WXSQLITE_FLOAT    2
00028 #define WXSQLITE_TEXT     3
00029 #define WXSQLITE_BLOB     4
00030 #define WXSQLITE_NULL     5
00031
00032 #if defined(_MSC_VER) || defined(__BORLANDC__)
00033   typedef __int64 wxsqlite_int64;
00034 #else
00035   typedef long long int wxsqlite_int64;
00036 #endif
00037
00038 enum wxSQLite3TransactionType
00039 {
00040   WXSQLITE_TRANSACTION_DEFAULT,
00041   WXSQLITE_TRANSACTION_DEFERRED,
00042   WXSQLITE_TRANSACTION_IMMEDIATE,
00043   WXSQLITE_TRANSACTION_EXCLUSIVE
00044 };
00045
00047 class WXDLLIMPEXP_SQLITE3 wxSQLite3Exception
00048 {
00049 public:
00051   wxSQLite3Exception(int errorCode, const wxString& errMsg);
00052
00054   wxSQLite3Exception(const wxSQLite3Exception&  e);
00055
00057   virtual ~wxSQLite3Exception();
00058
00060   const int GetErrorCode() { return m_errorCode; }
00061
00063   const wxString GetMessage() { return m_errorMessage; }
00064
00066   static const wxString ErrorCodeAsString(int errorCode);
00067
00068 private:
00069   int      m_errorCode;
00070   wxString m_errorMessage;
00071 };
00072
00074 class WXDLLIMPEXP_SQLITE3 wxSQLite3StatementBuffer
00075 {
00076 public:
00078   wxSQLite3StatementBuffer();
00079
00081   ~wxSQLite3StatementBuffer();
00082
00084
00111   const char* Format(const char* format, ...);
00112
00114
00117   operator const char*() const { return m_buffer; }
00118
00120   void Clear();
00121
00122 private:
00123   char* m_buffer;
00124 };
00125
00127
00133 class WXDLLIMPEXP_SQLITE3 wxSQLite3FunctionContext
00134 {
00135 public:
00137
00140   int GetArgCount();
00141
00143
00147   int GetArgType(int argIndex);
00148
00150
00154   bool IsNull(int argIndex);
00155
00157
00162   int GetInt(int argIndex, int nullValue = 0);
00163
00165
00170   wxLongLong GetInt64(int argIndex, wxLongLong nullValue = 0);
00171
00173
00178   double GetDouble(int argIndex, double nullValue = 0);
00179
00181
00186   wxString GetString(int argIndex, const wxString& nullValue = wxEmptyString);
00187
00189
00194   const unsigned char* GetBlob(int argIndex, int& len);
00195
00197
00200   void SetResult(int value);
00201
00203
00206   void SetResult(wxLongLong value);
00207
00209
00212   void SetResult(double value);
00213
00215
00218   void SetResult(const wxString& value);
00219
00221
00225   void SetResult(unsigned char* value, int len);
00226
00228   void SetResultNull();
00229
00231
00234   void SetResultArg(int argIndex);
00235
00237
00240   void SetResultError(const wxString& errmsg);
00241
00243
00246   int GetAggregateCount();
00247
00249
00260   void* GetAggregateStruct(int len);
00261
00263   static void ExecScalarFunction(void* ctx, int argc, void** argv);
00264
00266   static void ExecAggregateStep(void* ctx, int argc, void** argv);
00267
00269   static void ExecAggregateFinalize(void* ctx);
00270
00272   static int  ExecAuthorizer(void*, int type,
00273                              const char* arg1, const char* arg2,
00274                              const char* arg3, const char* arg4);
00275
00277   static int ExecCommitHook(void* hook);
00278
00280   static void ExecRollbackHook(void* hook);
00281
00283   static void ExecUpdateHook(void* hook, int type,
00284                              const char* database, const char* table,
00285                              wxsqlite_int64 rowid);
00286 private:
00288   wxSQLite3FunctionContext(void* ctx, bool isAggregate, int argc = 0, void** argv = NULL);
00289
00291   wxSQLite3FunctionContext(wxSQLite3FunctionContext& ctx);
00292
00293   void*  m_ctx;
00294   bool   m_isAggregate;
00295   int    m_argc;
00296   void** m_argv;
00297 };
00298
00299
00301
00303 class WXDLLIMPEXP_SQLITE3 wxSQLite3ScalarFunction
00304 {
00305 public:
00307   virtual ~wxSQLite3ScalarFunction() {}
00309
00313   virtual void Execute(wxSQLite3FunctionContext& ctx) = 0;
00314 };
00315
00316
00318
00320 class WXDLLIMPEXP_SQLITE3 wxSQLite3AggregateFunction
00321 {
00322 public:
00324   virtual ~wxSQLite3AggregateFunction() {}
00326
00330   virtual void Aggregate(wxSQLite3FunctionContext& ctx) = 0;
00331
00333
00339   virtual void Finalize(wxSQLite3FunctionContext& ctx) = 0;
00340 };
00341
00342
00344
00346 class WXDLLIMPEXP_SQLITE3 wxSQLite3Authorizer
00347 {
00348 public:
00350   enum wxAuthorizationCode
00351   {                                    // arg1 =          arg2 =
00352     SQLITE_COPY                =  0,   // Table Name      File Name
00353     SQLITE_CREATE_INDEX        =  1,   // Index Name      Table Name
00354     SQLITE_CREATE_TABLE        =  2,   // Table Name      NULL
00355     SQLITE_CREATE_TEMP_INDEX   =  3,   // Index Name      Table Name
00356     SQLITE_CREATE_TEMP_TABLE   =  4,   // Table Name      NULL
00357     SQLITE_CREATE_TEMP_TRIGGER =  5,   // Trigger Name    Table Name
00358     SQLITE_CREATE_TEMP_VIEW    =  6,   // View Name       NULL
00359     SQLITE_CREATE_TRIGGER      =  7,   // Trigger Name    Table Name
00360     SQLITE_CREATE_VIEW         =  8,   // View Name       NULL
00361     SQLITE_DELETE              =  9,   // Table Name      NULL
00362     SQLITE_DROP_INDEX          = 10,   // Index Name      Table Name
00363     SQLITE_DROP_TABLE          = 11,   // Table Name      NULL
00364     SQLITE_DROP_TEMP_INDEX     = 12,   // Index Name      Table Name
00365     SQLITE_DROP_TEMP_TABLE     = 13,   // Table Name      NULL
00366     SQLITE_DROP_TEMP_TRIGGER   = 14,   // Trigger Name    Table Name
00367     SQLITE_DROP_TEMP_VIEW      = 15,   // View Name       NULL
00368     SQLITE_DROP_TRIGGER        = 16,   // Trigger Name    Table Name
00369     SQLITE_DROP_VIEW           = 17,   // View Name       NULL
00370     SQLITE_INSERT              = 18,   // Table Name      NULL
00371     SQLITE_PRAGMA              = 19,   // Pragma Name     1st arg or NULL
00372     SQLITE_READ                = 20,   // Table Name      Column Name
00373     SQLITE_SELECT              = 21,   // NULL            NULL
00374     SQLITE_TRANSACTION         = 22,   // NULL            NULL
00375     SQLITE_UPDATE              = 23,   // Table Name      Column Name
00376     SQLITE_ATTACH              = 24,   // Filename        NULL
00377     SQLITE_DETACH              = 25,   // Database Name   NULL
00378     SQLITE_ALTER_TABLE         = 26,   // Database Name   Table Name
00379     SQLITE_REINDEX             = 27,   // Index Name      NULL
00380     SQLITE_ANALYZE             = 28,   // Table Name      NULL
00381     SQLITE_MAX_CODE            = SQLITE_ANALYZE
00382   };
00384   enum wxAuthorizationResult
00385   {
00386     SQLITE_OK     = 0,   // Allow access
00387     SQLITE_DENY   = 1,   // Abort the SQL statement with an error
00388     SQLITE_IGNORE = 2    // Don't allow access, but don't generate an error
00389   };
00391   virtual ~wxSQLite3Authorizer() {}
00393
00404   virtual wxAuthorizationResult Authorize(wxAuthorizationCode type,
00405                                           const wxString& arg1, const wxString& arg2,
00406                                           const wxString& arg3, const wxString& arg4) = 0;
00408
00411   static wxString AuthorizationCodeToString(wxSQLite3Authorizer::wxAuthorizationCode type);
00412 };
00413
00415
00417 class WXDLLIMPEXP_SQLITE3 wxSQLite3Hook
00418 {
00419 public:
00421   enum wxUpdateType
00422   {
00423     SQLITE_DELETE              =  9,
00424     SQLITE_INSERT              = 18,
00425     SQLITE_UPDATE              = 23
00426   };
00428   virtual ~wxSQLite3Hook() {}
00429
00431
00435   virtual bool CommitCallback() { return false; }
00436
00438
00441   virtual void RollbackCallback() {}
00442
00444
00453   virtual void UpdateCallback(wxUpdateType WXUNUSED(type),
00454                               const wxString& WXUNUSED(database), const wxString& WXUNUSED(table),
00455                               wxLongLong WXUNUSED(rowid)) {};
00456 };
00457
00459 class WXDLLIMPEXP_SQLITE3 wxSQLite3ResultSet
00460 {
00461 public:
00463   wxSQLite3ResultSet();
00464
00466   wxSQLite3ResultSet(const wxSQLite3ResultSet& resultSet);
00467
00469   wxSQLite3ResultSet(void* db, void* stmt,
00470                      bool eof, bool first = true, bool ownStmt = true);
00471
00473   wxSQLite3ResultSet& operator=(const wxSQLite3ResultSet& resultSet);
00474
00476
00478   virtual ~wxSQLite3ResultSet();
00479
00481
00484   int GetColumnCount();
00485
00487
00491   int FindColumnIndex(const wxString& columnName);
00492
00494
00498   wxString GetColumnName(int columnIndex);
00499
00501
00505   wxString GetDeclaredColumnType(int columnIndex);
00506
00508
00512   int GetColumnType(int columnIndex);
00513
00514 #ifdef WXSQLITE3_HAVE_METADATA
00515
00516
00522   wxString GetDatabaseName(int columnIndex);
00523
00525
00531   wxString GetTableName(int columnIndex);
00532
00534
00540   wxString GetOriginName(int columnIndex);
00541 #endif
00542
00544
00548   wxString GetAsString(int columnIndex);
00549
00551
00555   wxString GetAsString(const wxString& columnName);
00556
00558
00563   int GetInt(int columnIndex, int nullValue = 0);
00564
00566
00571   int GetInt(const wxString& columnName, int nullValue = 0);
00572
00574
00579   wxLongLong GetInt64(int columnIndex, wxLongLong nullValue = 0);
00580
00582
00587   wxLongLong GetInt64(const wxString& columnName, wxLongLong nullValue = 0);
00588
00590
00595   double GetDouble(int columnIndex, double nullValue = 0.0);
00596
00598
00603   double GetDouble(const wxString& columnName, double nullValue = 0.0);
00604
00606
00611   wxString GetString(int columnIndex, const wxString& nullValue = wxEmptyString);
00612
00614
00619   wxString GetString(const wxString& columnName, const wxString& nullValue = wxEmptyString);
00620
00622
00627   const unsigned char* GetBlob(int columnIndex, int& len);
00628
00630
00635   const unsigned char* GetBlob(const wxString& columnName, int& len);
00636
00638
00642   wxDateTime GetDate(int columnIndex);
00643
00645
00649   wxDateTime GetDate(const wxString& columnName);
00650
00652
00656   wxDateTime GetTime(int columnIndex);
00657
00659
00663   wxDateTime GetTime(const wxString& columnName);
00664
00666
00670   wxDateTime GetDateTime(int columnIndex);
00671
00673
00677   wxDateTime GetDateTime(const wxString& columnName);
00678
00680
00684   wxDateTime GetTimestamp(int columnIndex);
00685
00687
00691   wxDateTime GetTimestamp(const wxString& columnName);
00692
00694
00698   bool GetBool(int columnIndex);
00699
00701
00705   bool GetBool(const wxString& columnName);
00706
00708
00712   bool IsNull(int columnIndex);
00713
00715
00719   bool IsNull(const wxString& columnName);
00720
00722
00725   bool Eof();
00726
00728
00734   bool NextRow();
00735
00737
00739   void Finalize();
00740
00741 private:
00743   void CheckStmt();
00744
00745   void* m_db;
00746   void* m_stmt;
00747   bool  m_eof;
00748   bool  m_first;
00749   int   m_cols;
00750   bool  m_ownStmt;
00751 };
00752
00753
00755 class WXDLLIMPEXP_SQLITE3 wxSQLite3Table
00756 {
00757 public:
00759   wxSQLite3Table();
00760
00761   wxSQLite3Table(const wxSQLite3Table& table);
00762
00763   wxSQLite3Table(char** results, int rows, int cols);
00764
00765   virtual ~wxSQLite3Table();
00766
00767   wxSQLite3Table& operator=(const wxSQLite3Table& table);
00768
00770
00773   int GetColumnCount();
00774
00776
00779   int GetRowCount();
00780
00782
00786   int FindColumnIndex(const wxString& columnName);
00787
00789
00793   wxString GetColumnName(int columnIndex);
00794
00796
00800   wxString GetAsString(int columnIndex);
00801
00803
00807   wxString GetAsString(const wxString& columnName);
00808
00810
00815   int GetInt(int columnIndex, int nullValue = 0);
00816
00818
00823   int GetInt(const wxString& columnName, int nullValue = 0);
00824
00826
00831   wxLongLong GetInt64(int columnIndex, wxLongLong nullValue = 0);
00832
00834
00839   wxLongLong GetInt64(const wxString& columnName, wxLongLong nullValue = 0);
00840
00842
00847   double GetDouble(int columnIndex, double nullValue = 0.0);
00848
00850
00855   double GetDouble(const wxString& columnName, double nullValue = 0.0);
00856
00858
00863   wxString GetString(int columnIndex, const wxString& nullValue = wxEmptyString);
00864
00866
00871   wxString GetString(const wxString& columnName, const wxString& nullValue = wxEmptyString);
00872
00874
00878   wxDateTime GetDate(int columnIndex);
00879
00881
00885   wxDateTime GetDate(const wxString& columnName);
00886
00888
00892   wxDateTime GetTime(int columnIndex);
00893
00895
00899   wxDateTime GetTime(const wxString& columnName);
00900
00902
00906   wxDateTime GetDateTime(int columnIndex);
00907
00909
00913   wxDateTime GetDateTime(const wxString& columnName);
00914
00916
00920   bool GetBool(int columnIndex);
00921
00923
00927   bool GetBool(const wxString& columnName);
00928
00930
00934   bool IsNull(int columnIndex);
00935
00937
00941   bool IsNull(const wxString& columnName);
00942
00944
00947   void SetRow(int row);
00948
00950
00952   void Finalize();
00953
00954 private:
00956     void CheckResults();
00957
00958     int m_cols;
00959     int m_rows;
00960     int m_currentRow;
00961     char** m_results;
00962 };
00963
00964
00966 class WXDLLIMPEXP_SQLITE3 wxSQLite3Statement
00967 {
00968 public:
00970
00972   wxSQLite3Statement();
00973
00975
00977   wxSQLite3Statement(const wxSQLite3Statement& statement);
00978
00980
00982   wxSQLite3Statement& operator=(const wxSQLite3Statement& statement);
00983
00985
00987   wxSQLite3Statement(void* db, void* stmt);
00988
00990
00992   virtual ~wxSQLite3Statement();
00993
00995
00998   int ExecuteUpdate();
00999
01001
01004   wxSQLite3ResultSet ExecuteQuery();
01005
01007
01010   int GetParamCount();
01011
01013
01018   int GetParamIndex(const wxString& paramName);
01019
01021
01027   wxString GetParamName(int paramIndex);
01028
01030
01034   void Bind(int paramIndex, const wxString& stringValue);
01035
01037
01041   void Bind(int paramIndex, int intValue);
01042
01044
01048   void Bind(int paramIndex, wxLongLong int64Value);
01049
01051
01055   void Bind(int paramIndex, double doubleValue);
01056
01058
01062   void Bind(int paramIndex, const char* charValue);
01063
01065
01070   void Bind(int paramIndex, const unsigned char* blobValue, int blobLen);
01071
01073
01077   void BindDate(int paramIndex, const wxDateTime& date);
01078
01080
01084   void BindTime(int paramIndex, const wxDateTime& time);
01085
01087
01091   void BindDateTime(int paramIndex, const wxDateTime& datetime);
01092
01094
01098   void BindTimestamp(int paramIndex, const wxDateTime& timestamp);
01099
01101
01105   void BindBool(int paramIndex, bool value);
01106
01108
01111   void BindNull(int paramIndex);
01112
01114
01117   void ClearBindings();
01118
01120
01124   void Reset();
01125
01127
01129   void Finalize();
01130
01131 private:
01133   void CheckDatabase();
01134
01136   void CheckStmt();
01137
01138   void* m_db;
01139   void* m_stmt;
01140 };
01141
01142
01144 class WXDLLIMPEXP_SQLITE3 wxSQLite3Database
01145 {
01146 public:
01148
01152   wxSQLite3Database();
01153
01155
01159   virtual ~wxSQLite3Database();
01160
01162
01168   void Open(const wxString& fileName);
01169
01171
01174   bool IsOpen();
01175
01177
01180   void Close();
01181
01183
01201   void Begin(wxSQLite3TransactionType transactionType = WXSQLITE_TRANSACTION_DEFAULT);
01202
01204
01206   void Commit();
01207
01209
01211   void Rollback();
01212
01214
01220   bool GetAutoCommit();
01221
01223
01227   bool TableExists(const wxString& tableName);
01228
01230
01234   bool CheckSyntax(const wxString& sql);
01235
01237
01241   bool CheckSyntax(const wxSQLite3StatementBuffer& sql);
01242
01244
01248   bool CheckSyntax(const char* sql);
01249
01251
01255   int ExecuteUpdate(const wxString& sql);
01256
01258
01262   int ExecuteUpdate(const wxSQLite3StatementBuffer& sql);
01263
01265
01269   int ExecuteUpdate(const char* sql);
01270
01272
01276   wxSQLite3ResultSet ExecuteQuery(const wxString& sql);
01277
01279
01283   wxSQLite3ResultSet ExecuteQuery(const wxSQLite3StatementBuffer& sql);
01284
01286
01290   wxSQLite3ResultSet ExecuteQuery(const char* sql);
01291
01293
01299   int ExecuteScalar(const wxString& sql);
01300
01302
01308   int ExecuteScalar(const wxSQLite3StatementBuffer& sql);
01309
01311
01317   int ExecuteScalar(const char* sql);
01318
01320
01325   wxSQLite3Table GetTable(const wxString& sql);
01326
01328
01333   wxSQLite3Table GetTable(const wxSQLite3StatementBuffer& sql);
01334
01336
01341   wxSQLite3Table GetTable(const char* sql);
01342
01344
01348   wxSQLite3Statement PrepareStatement(const wxString& sql);
01349
01351
01355   wxSQLite3Statement PrepareStatement(const wxSQLite3StatementBuffer& sql);
01356
01358
01362   wxSQLite3Statement PrepareStatement(const char* sql);
01363
01365
01372   wxLongLong GetLastRowId();
01373
01375
01380   void Interrupt();
01381
01383
01390   void SetBusyTimeout(int milliSeconds);
01391
01393
01401   bool CreateFunction(const wxString& name, int argCount, wxSQLite3ScalarFunction& function);
01402
01404
01412   bool CreateFunction(const wxString& name, int argCount, wxSQLite3AggregateFunction& function);
01413
01415
01423   bool SetAuthorizer(wxSQLite3Authorizer& authorizer);
01424
01426
01433   void SetCommitHook(wxSQLite3Hook* commitHook);
01434
01436
01447   void SetRollbackHook(wxSQLite3Hook* rollbackHook);
01448
01450
01457   void SetUpdateHook(wxSQLite3Hook* updateHook);
01458
01459 #ifdef WXSQLITE3_HAVE_METADATA
01460
01461
01472   void GetMetaData(const wxString& dbName, const wxString& tableName, const wxString& columnName,
01473                    wxString* dataType = NULL, bool* notNull = NULL, bool* primaryKey = NULL, bool* autoIncrement = NULL);
01474 #endif
01475
01477
01480   static wxString GetVersion();
01481
01482 private:
01484   wxSQLite3Database(const wxSQLite3Database& db);
01485
01487   wxSQLite3Database& operator=(const wxSQLite3Database& db);
01488
01490   void* Prepare(const char* sql);
01491
01493   void CheckDatabase();
01494
01495   void* m_db;
01496   int   m_busyTimeoutMs;
01497 };
01498
01499 #endif
01500
Generated on Fri Aug 4 12:22:56 2006 for wxSqlite3 by doxygen 1.4.6-NO


wxSqlite3: C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3def.h File Reference

  • File List
  • File Members

C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3def.h File Reference

Compile time switches for the wxSQLite3 class. More...

Go to the source code of this file.

Defines

#define | wxUSE_DYNAMIC_SQLITE3_LOAD 0
#define | WXDLLIMPEXP_SQLITE3

Detailed Description

Compile time switches for the wxSQLite3 class.

Definition in file wxsqlite3def.h.

Define Documentation

#define wxUSE_DYNAMIC_SQLITE3_LOAD 0

If this define is set to 1, then the SQLite library will be loaded dynamically otherwise a link library is required to build wxSQLite3.

Definition at line 135 of file wxsqlite3def.h.


wxSqlite3: C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3def.h Source File

  • File List
  • File Members

C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3def.h

Go to the documentation of this file.
00001
00002 // Name:        wxsqlite3def.h
00003 // Purpose:     wxWidgets wrapper around the SQLite3 embedded database library.
00004 // Author:      Ulrich Telle
00005 // Modified by:
00006 // Created:     2005-07-14
00007 // Changes:     2005-10-03  - Upgrade to SQLite3 version 3.2.7
00008 //              2005-10-09  - Corrected error in wxSQLite3Table::FindColumnIndex
00009 //              2005-10-30  - Added wxGTK build support
00010 //              2005-11-01  - Corrected wxSQLite3ResultSet::GetInt64.
00011 //                            Added wxSQLite3Table::GetInt64
00012 //              2005-11-09  - Optionally load SQLite library dynamically
00013 //              2006-02-01  - Upgrade to SQLite3 version 3.3.3
00014 //              2006-02-12  - Upgrade to SQLite3 version 3.3.4 (wxMSW only)
00015 //              2006-03-15  - Fixed a bug in wxSQLite3Database::Prepare
00016 //                            Added wxSQLite3Database::IsOpen for convenience
00017 //              2006-06-11  - Upgrade to SQLite3 version 3.3.6
00018 //                            Added support for optional SQLite meta data methods
00019 // Copyright:   (c) Ulrich Telle
00020 // Licence:     wxWindows licence
00022
00024
00126 #ifndef _WX_SQLITE3_DEF_H_
00127 #define _WX_SQLITE3_DEF_H_
00128
00129 // Conditional compilation
00130 // -----------------------
00131
00134 #ifndef wxUSE_DYNAMIC_SQLITE3_LOAD
00135     #define wxUSE_DYNAMIC_SQLITE3_LOAD   0
00136 #endif
00137
00138 #ifdef WXMAKINGDLL_WXSQLITE3
00139     #define WXDLLIMPEXP_SQLITE3 WXEXPORT
00140 #elif defined(WXUSINGDLL_WXSQLITE3)
00141     #define WXDLLIMPEXP_SQLITE3 WXIMPORT
00142 #else // not making nor using DLL
00143     #define WXDLLIMPEXP_SQLITE3
00144 #endif
00145
00148 #if 0
00149 #define WXSQLITE3_HAVE_METADATA
00150 #endif
00151
00152 #endif // _WX_SQLITE3_DEF_H_
00153
Generated on Fri Aug 4 12:22:56 2006 for wxSqlite3 by doxygen 1.4.6-NO


wxSqlite3: C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3dyn.h File Reference

  • File List
  • File Members

C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3dyn.h File Reference

Definition of the SQLite3 API functions. More...

Go to the source code of this file.

Detailed Description

Definition of the SQLite3 API functions.

Definition in file wxsqlite3dyn.h.


wxSqlite3: C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3dyn.h Source File

  • File List
  • File Members

C:/Dev-Cpp/docs/DocSqlite/wxSqlite3/wxsqlite3dyn.h

Go to the documentation of this file.
00001
00002 // Name:        wxsqlite3dyn.h
00003 // Purpose:     wxWidgets wrapper around the SQLite3 embedded database library.
00004 // Author:      Ulrich Telle
00005 // Modified by:
00006 // Created:     2005-11-12
00007 // Copyright:   (c) Ulrich Telle
00008 // Licence:     wxWindows licence
00010
00012
00013 #ifdef DYNFUNC
00014
00015 DYNFUNC(return, void *,                sqlite3_aggregate_context,    (sqlite3_context *p, int nBytes), (p, nBytes));
00016 DYNFUNC(return, int,                   sqlite3_aggregate_count,      (sqlite3_context *p), (p));
00017 DYNFUNC(return, int,                   sqlite3_bind_blob,            (sqlite3_stmt *pStmt, int i, const void *zData, int nData, void (*xDel)(void*)), (pStmt, i, zData, nData, xDel));
00018 DYNFUNC(return, int,                   sqlite3_bind_double,          (sqlite3_stmt *pStmt, int i, double rValue), (pStmt, i, rValue));
00019 DYNFUNC(return, int,                   sqlite3_bind_int,             (sqlite3_stmt *pStmt, int i, int iValue), (pStmt, i, iValue));
00020 DYNFUNC(return, int,                   sqlite3_bind_int64,           (sqlite3_stmt *pStmt, int i, sqlite_int64 iValue), (pStmt, i, iValue));
00021 DYNFUNC(return, int,                   sqlite3_bind_null,            (sqlite3_stmt *pStmt, int i), (pStmt, i));
00022 DYNFUNC(return, int,                   sqlite3_bind_parameter_count, (sqlite3_stmt *pStmt), (pStmt));
00023 DYNFUNC(return, int,                   sqlite3_bind_parameter_index, (sqlite3_stmt *pStmt, const char *zName), (pStmt, zName));
00024 DYNFUNC(return, const char *,          sqlite3_bind_parameter_name,  (sqlite3_stmt *pStmt, int i), (pStmt, i));
00025 DYNFUNC(return, int,                   sqlite3_bind_text,            (sqlite3_stmt *pStmt, int i, const char *zData, int nData, void (*xDel)(void*)), (pStmt, i, zData, nData, xDel));
00026 // DYNFUNC(return, int,                   sqlite3_bind_text16,          (sqlite3_stmt *pStmt, int i, const void *zData, int nData, void (*xDel)(void*)), (pStmt, i, zData, nData, xDel));
00027 // DYNFUNC(return, int,                   sqlite3_bind_value,           (sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue), (pStmt, i, pValue));
00028 // DYNFUNC(return, int,                   sqlite3_busy_handler,         (sqlite3 *db, int (*xBusy)(void*,int), void *pArg), (db, xBusy, pArg));
00029 DYNFUNC(return, int,                   sqlite3_busy_timeout,         (sqlite3 *db, int ms), (db, ms));
00030 DYNFUNC(return, int,                   sqlite3_changes,              (sqlite3 *db), (db));
00031 // DYNFUNC(return, int,                   sqlite3_clear_bindings,       (sqlite3_stmt *pStmt), (pStmt));
00032 DYNFUNC(return, int,                   sqlite3_close,                (sqlite3 *db), (db));
00033 // DYNFUNC(return, int,                   sqlite3_collation_needed,     (sqlite3 *db, void *pCollNeededArg, void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)), (db, pCollNeededArg, xCollNeeded));
00034 // DYNFUNC(return, int,                   sqlite3_collation_needed16,   (sqlite3 *db, void *pCollNeededArg, void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)), (db, pCollNeededArg, xCollNeeded16));
00035 DYNFUNC(return, const void *,          sqlite3_column_blob,          (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00036 DYNFUNC(return, int,                   sqlite3_column_bytes,         (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00037 // DYNFUNC(return, int,                   sqlite3_column_bytes16,       (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00038 DYNFUNC(return, int,                   sqlite3_column_count,         (sqlite3_stmt *pStmt), (pStmt));
00039 DYNFUNC(return, const char *,          sqlite3_column_decltype,      (sqlite3_stmt *pStmt, int i), (pStmt, i));
00040 // DYNFUNC(return, const void *,          sqlite3_column_decltype16,    (sqlite3_stmt *pStmt, int i), (pStmt, i));
00041 DYNFUNC(return, double,                sqlite3_column_double,        (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00042 DYNFUNC(return, int,                   sqlite3_column_int,           (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00043 DYNFUNC(return, sqlite_int64,          sqlite3_column_int64,         (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00044 DYNFUNC(return, const char *,          sqlite3_column_name,          (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00045 // DYNFUNC(return, const void *,          sqlite3_column_name16,        (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00046 DYNFUNC(return, const unsigned char *, sqlite3_column_text,          (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00047 // DYNFUNC(return, const void *,          sqlite3_column_text16,        (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00048 DYNFUNC(return, int,                   sqlite3_column_type,          (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00049 DYNFUNC(return, void *,                sqlite3_commit_hook,          (sqlite3 *db, int (*xCallback)(void*), void *pArg), (db, xCallback, pArg));
00050 DYNFUNC(return, int,                   sqlite3_complete,             (const char *sql), (sql));
00051 // DYNFUNC(return, int,                   sqlite3_complete16,           (const void *sql), (sql));
00052 // DYNFUNC(return, int,                   sqlite3_create_collation,     (sqlite3 *db, const char *zName, int eTextRep, void*v, int(*xCompare)(void*,int,const void*,int,const void*)), (db, zName, eTextRep, v, xCompare));
00053 // DYNFUNC(return, int,                   sqlite3_create_collation16,   (sqlite3 *db, const char *zName, int eTextRep, void*v, int(*xCompare)(void*,int,const void*,int,const void*)), (db, zName, eTextRep, v, xCompare));
00054 DYNFUNC(return, int,                   sqlite3_create_function,      (sqlite3 *db, const char *zFunctionName, int nArg, int eTextRep, void*v, void (*xFunc)(sqlite3_context*,int,sqlite3_value**), void (*xStep)(sqlite3_context*,int,sqlite3_value**), void (*xFinal)(sqlite3_context*)), (db, zFunctionName, nArg, eTextRep, v, xFunc, xStep, xFinal));
00055 // DYNFUNC(return, int,                   sqlite3_create_function16,    (sqlite3 *db, const void *zFunctionName, int nArg, int eTextRep, void*v, void (*xFunc)(sqlite3_context*,int,sqlite3_value**), void (*xStep)(sqlite3_context*,int,sqlite3_value**), void (*xFinal)(sqlite3_context*)), (db, zFunctionName, nArg, eTextRep, v, xFunc, xStep, xFinal));
00056 // DYNFUNC(return, int,                   sqlite3_data_count,           (sqlite3_stmt *pStmt), (pStmt));
00057 // DYNFUNC(return, sqlite3 *,             sqlite3_db_handle,            (sqlite3_stmt *pStmt), (pStmt));
00058 // DYNFUNC(return, int,                   sqlite3_errcode,              (sqlite3 *db), (db));
00059 DYNFUNC(return, const char *,          sqlite3_errmsg,               (sqlite3 *db), (db));
00060 // DYNFUNC(return, const void *,          sqlite3_errmsg16,             (sqlite3 *db), (db));
00061 DYNFUNC(return, int,                   sqlite3_exec,                 (sqlite3 *db, const char *sql, sqlite3_callback c, void *v, char **errmsg), (db, sql, c, v, errmsg));
00062 // DYNFUNC(return, int,                   sqlite3_expired,              (sqlite3_stmt *pStmt), (pStmt));
00063 DYNFUNC(return, int,                   sqlite3_finalize,             (sqlite3_stmt *pStmt), (pStmt));
00064 DYNFUNC(;, void,                       sqlite3_free,                 (char *z), (z));
00065 DYNFUNC(;, void,                       sqlite3_free_table,           (char **result), (result));
00066 DYNFUNC(return, int,                   sqlite3_get_autocommit,       (sqlite3 *db), (db));
00067 // DYNFUNC(return, void *,                sqlite3_get_auxdata,          (sqlite3_context *pCtx, int iArg), (pCtx, iArg));
00068 DYNFUNC(return, int,                   sqlite3_get_table,            (sqlite3 *db, const char *sql, char ***resultp, int *nrow, int *ncolumn, char **errmsg), (db, sql, resultp, nrow, ncolumn, errmsg));
00069 // DYNFUNC(return, int,                   sqlite3_global_recover,       (), ());
00070 DYNFUNC(;, void,                       sqlite3_interrupt,            (sqlite3 *db), (db));
00071 DYNFUNC(return, sqlite_int64,          sqlite3_last_insert_rowid,    (sqlite3 *db), (db));
00072 DYNFUNC(return, const char *,          sqlite3_libversion,           (void), ());
00073 // DYNFUNC(return, int,                   sqlite3_libversion_number,    (void), ());
00074 // DYNFUNC(return, char *,                sqlite3_mprintf,              (const char *zFormat,...), (zFormat,...));
00075 DYNFUNC(return, int,                   sqlite3_open,                 (const char *filename, sqlite3 **ppDb), (filename, ppDb));
00076 // DYNFUNC(return, int,                   sqlite3_open16,               (const void *filename, sqlite3 **ppDb), (filename, ppDb));
00077 DYNFUNC(return, int,                   sqlite3_prepare,              (sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail), (db, zSql, nBytes, ppStmt, pzTail));
00078 // DYNFUNC(return, int,                   sqlite3_prepare16,            (sqlite3 *db, const void *zSql, int nBytes, sqlite3_stmt **ppStmt, const void **pzTail), (db, zSql, nBytes, ppStmt, pzTail));
00079 // DYNFUNC(;, void,                       sqlite3_progress_handler,     (sqlite3 *db, int nOps, int (*xProgress)(void*), void *pArg), (db, nOps, xProgress, pArg));
00080 DYNFUNC(return, int,                   sqlite3_reset,                (sqlite3_stmt *pStmt), (pStmt));
00081 DYNFUNC(;, void,                       sqlite3_result_blob,          (sqlite3_context *pCtx, const void *z, int n, void (*xDel)(void *)), (pCtx, z, n, xDel));
00082 DYNFUNC(;, void,                       sqlite3_result_double,        (sqlite3_context *pCtx, double rVal), (pCtx, rVal));
00083 DYNFUNC(;, void,                       sqlite3_result_error,         (sqlite3_context *pCtx, const char *z, int n), (pCtx, z, n));
00084 // DYNFUNC(;, void,                       sqlite3_result_error16,       (sqlite3_context *pCtx, const void *z, int n), (pCtx, z, n));
00085 DYNFUNC(;, void,                       sqlite3_result_int,           (sqlite3_context *pCtx, int iVal), (pCtx, iVal));
00086 DYNFUNC(;, void,                       sqlite3_result_int64,         (sqlite3_context *pCtx, sqlite_int64 iVal), (pCtx, iVal));
00087 DYNFUNC(;, void,                       sqlite3_result_null,          (sqlite3_context *pCtx), (pCtx));
00088 DYNFUNC(;, void,                       sqlite3_result_text,          (sqlite3_context *pCtx, const char *z, int n, void (*xDel)(void *)), (pCtx, z, n, xDel));
00089 // DYNFUNC(;, void,                       sqlite3_result_text16,        (sqlite3_context *pCtx, const void *z, int n, void (*xDel)(void *)), (pCtx, z, n, xDel));
00090 // DYNFUNC(;, void,                       sqlite3_result_text16be,      (sqlite3_context *pCtx, const void *z, int n, void (*xDel)(void *)), (pCtx, z, n, xDel));
00091 // DYNFUNC(;, void,                       sqlite3_result_text16le,      (sqlite3_context *pCtx, const void *z, int n, void (*xDel)(void *)), (pCtx, z, n, xDel));
00092 DYNFUNC(;, void,                       sqlite3_result_value,         (sqlite3_context *pCtx, sqlite3_value *pValue), (pCtx, pValue));
00093 DYNFUNC(return, void *,                sqlite3_rollback_hook,        (sqlite3 *db, void (*xCallback)(void*), void *pArg), (db, xCallback, pArg));
00094 DYNFUNC(return, int,                   sqlite3_set_authorizer,       (sqlite3 *db, int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pArg), (db, xAuth, pArg));
00095 // DYNFUNC(;, void,                       sqlite3_set_auxdata,          (sqlite3_context *pCtx, int iArg, void *pAux, void (*xDelete)(void*)), (pCtx, iArg, pAux, xDelete));
00096 // DYNFUNC(return, char *,                sqlite3_snprintf,             (int n, char *zBuf, const char *zFormat, ...), (n, zBuf, zFormat, ...));
00097 DYNFUNC(return, int,                   sqlite3_step,                 (sqlite3_stmt *pStmt), (pStmt));
00098 // DYNFUNC(return, int,                   sqlite3_total_changes,        (sqlite3 *db), (db));
00099 // DYNFUNC(return, void *,                sqlite3_trace,                (sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg), (db, xTrace, pArg));
00100 // DYNFUNC(return, int,                   sqlite3_transfer_bindings,    (sqlite3_stmt *pStmt, sqlite3_stmt *pStmt), (pStmt, pStmt));
00101 DYNFUNC(return, void *,                sqlite3_update_hook,          (sqlite3 *db, void (*xCallback)(void *, int, char const *, char const *, wxsqlite_int64), void *pArg), (db, xCallback, pArg));
00102 DYNFUNC(return, void *,                sqlite3_user_data,            (sqlite3_context *pCtx), (pCtx));
00103 DYNFUNC(return, const void *,          sqlite3_value_blob,           (sqlite3_value *pVal), (pVal));
00104 DYNFUNC(return, int,                   sqlite3_value_bytes,          (sqlite3_value *pVal), (pVal));
00105 // DYNFUNC(return, int,                   sqlite3_value_bytes16,        (sqlite3_value *pVal), (pVal));
00106 DYNFUNC(return, double,                sqlite3_value_double,         (sqlite3_value *pVal), (pVal));
00107 DYNFUNC(return, int,                   sqlite3_value_int,            (sqlite3_value *pVal), (pVal));
00108 DYNFUNC(return, sqlite_int64,          sqlite3_value_int64,          (sqlite3_value *pVal), (pVal));
00109 DYNFUNC(return, const unsigned char *, sqlite3_value_text,           (sqlite3_value *pVal), (pVal));
00110 // DYNFUNC(return, const void *,          sqlite3_value_text16,         (sqlite3_value *pVal), (pVal));
00111 // DYNFUNC(return, const void *,          sqlite3_value_text16be,       (sqlite3_value *pVal), (pVal));
00112 // DYNFUNC(return, const void *,          sqlite3_value_text16le,       (sqlite3_value *pVal), (pVal));
00113 DYNFUNC(return, int,                   sqlite3_value_type,           (sqlite3_value *pVal), (pVal));
00114 DYNFUNC(return, char *,                sqlite3_vmprintf,             (const char* p, va_list ap), (p, ap));
00115
00116 #ifdef WXSQLITE3_HAVE_METADATA
00117 DYNFUNC(return, const char *,          sqlite3_column_database_name, (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00118 // DYNFUNC(return, const void *,          sqlite3_column_database_name16, (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00119 DYNFUNC(return, const char *,          sqlite3_column_table_name, (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00120 // DYNFUNC(return, const void *,          sqlite3_column_table_name16, (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00121 DYNFUNC(return, const char *,          sqlite3_column_origin_name, (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00122 // DYNFUNC(return, const void *,          sqlite3_column_origin_name16, (sqlite3_stmt *pStmt, int iCol), (pStmt, iCol));
00123 DYNFUNC(return, int,                   sqlite3_table_column_metadata, (sqlite3 *db, const char *zDbName, const char *zTableName, const char *zColumnName, char const **pzDataType, char const **pzCollSeq, int *pNotNull, int *pPrimaryKey, int *pAutoinc), (db, zDbName, zTableName, zColumnName, pzDataType, pzCollSeq, pNotNull, pPrimaryKey, pAutoinc));
00124 #endif
00125
00126 #endif
Generated on Fri Aug 4 12:22:56 2006 for wxSqlite3 by doxygen 1.4.6-NO