WxSQLite
From WxWiki
[edit] wxSQLite
A wxWidgets wrapper around the sqlite database.
It handles:
- Opening Database (duh !)
- Thread safety
- Fetch style access to SQL Query results
- Tested under windows, but should work under any system that compiles wxWidgets (ie. Linux, Mac etc) (Linus McCabe: I've used it on Linux for a few days without problems)
Used in:
- SQLiteCC is a wxWidgets & wxSQLite based program and could be useful for a reference program.
[edit] Alternatives
- Metakit is also a good, small, crossplatform database.
- ctree c-tree from FairCom runs on a lot of platforms. I used it on Mac 68K a few years ago. Their Web site says to call for details on that platform, they probably send you an older version for 68K. But it does run on Mac PPC System 7-9. Plus Windows & Linux.
- Firebird is a cross-platform database that can run embedded or as a client/server database. Originally based on Borland's Interbase database. To get a better idea of the project activity go to the site http://www.ibphoenix.com/
- wxSQLite3 wxWindows wrapper for SQLite 3.x. Inspired by wxSQLite and CppSQLite, supporting most features of SQLite 3 including user-defined functions.
[edit] Functions
Please note that the following is incomplete. Please contribute your knowledge to help others.
[edit] wxSQLiteDatabase
[edit] wxSQLiteDatabase::wxSQLiteDatabase
wxSQLiteDatabase (wxString filename)
filename is the database file to open. If the file does not exist, it will be created.
[edit] wxSQLiteDatabase::~wxSQLiteDatabase
~wxSQLiteDatabase ()
Destructor. Calls Close().
[edit] wxSQLiteDatabase::Open
bool Open (wxString filename)
filename is the database file to open. If the file does not exist, it will be created.
[edit] wxSQLiteDatabase::Close
bool Close ()
Closes the current database file.
[edit] wxSQLiteDatabase::TableExists
bool TableExists (wxString table-name)
Check if a table exists.
table-name is the name of the table to check.
[edit] wxSQLiteDatabase::BeginTransaction
void BeginTransaction ()
[edit] wxSQLiteDatabase::Commit
void Commit ()
[edit] wxSQLiteDatabase::Rollback
void Rollback ()
[edit] wxSQLiteDatabase::LastInsertRowId
int LastInsertRowId ()
Obtain the value used for an auto_increment field after an INSERT.
[edit] wxSQLiteQueryResult
Derived from wxSQLiteQueryBase
[edit] wxSQLiteQueryResult::wxSQLiteQueryResult
wxSQLiteQueryResult (wxSQLiteDatabase& db)
db is the reference to the wxSQLiteDatabase instance.
[edit] wxSQLiteQueryResult::~wxSQLiteQueryResult
~wxSQLiteQueryResult ()
Destructor. Calls wxsqlite_free_table(result).
[edit] wxSQLiteQueryResult::Execute
bool Execute (const char *sql, ...)
Execute SQL query. Returns TRUE if the query was executed successfully, otherwise FALSE.
[edit] wxSQLiteQueryResult::NumChanges
int NumChanges ()
[edit] wxSQLiteQueryResult::NumRows
int NumRows ()
[edit] wxSQLiteQueryResult::NumCols
int NumCols ()
[edit] wxSQLiteQueryResult::GetFieldName
char *GetFieldName (int fieldIndex)
Returns the name of the field at index fieldIndex, where indexes start at 0.
