#include <database.h>
Definition at line 10 of file database.h.
Public Member Functions | |
wxDatabase () | |
Constructor. More... | |
virtual | ~wxDatabase () |
Destructor. More... | |
virtual bool | Open (const wxString &strDatabase)=0 |
virtual bool | ChangeDatabase (const wxString &database) |
virtual bool | Close ()=0 |
close database More... | |
virtual bool | IsOpen ()=0 |
Is the connection to the database open? More... | |
virtual void | BeginTransaction ()=0 |
Begin a transaction. More... | |
virtual void | Commit ()=0 |
Commit the current transaction. More... | |
virtual void | RollBack ()=0 |
Rollback the current transaction. More... | |
virtual int | RunQuery (const wxString &strQuery) |
Run an insert, update, or delete query on the database. More... | |
virtual int | RunQuery (const wxString &strQuery, bool bParseQueries)=0 |
Run an insert, update, or delete query on the database. More... | |
virtual wxDatabaseResultSet * | RunQueryWithResults (const wxString &strQuery)=0 |
Run a select query on the database. More... | |
virtual bool | CloseResultSet (wxDatabaseResultSet *pResultSet) |
Close a result set returned by the database or a prepared statement previously. More... | |
virtual wxPreparedStatement * | PrepareStatement (const wxString &strQuery)=0 |
Prepare a SQL statement which can be reused with different parameters. More... | |
virtual bool | CloseStatement (wxPreparedStatement *pStatement) |
Close a prepared statement previously prepared by the database. More... | |
int | ExecuteUpdate (const wxString &strQuery) |
See RunQuery. More... | |
wxDatabaseResultSet * | ExecuteQuery (const wxString &strQuery) |
See RunQueryWithResults. More... | |
virtual bool | TableExists (const wxString &table)=0 |
Check for the existence of a table by name. More... | |
virtual bool | ViewExists (const wxString &view)=0 |
Check for the existence of a view by name. More... | |
virtual wxArrayString | GetTables ()=0 |
Retrieve all table names. More... | |
virtual wxArrayString | GetViews ()=0 |
Retrieve all view names. More... | |
virtual wxArrayString | GetColumns (const wxString &table)=0 |
Retrieve all column names for a table. More... | |
virtual wxArrayString | GetPKColumns (const wxString &table)=0 |
get Primary keys column names More... | |
virtual int | GetSingleResultInt (const wxString &strSQL, int nField, bool bRequireUniqueResult=true) |
With the GetSingleResultX API, two additional exception types are thrown: wxDATABASE_NO_ROWS_FOUND - No database rows were returned wxDATABASE_NON_UNIQUE_RESULTSET - More than one database row was returned. More... | |
virtual int | GetSingleResultInt (const wxString &strSQL, const wxString &strField, bool bRequireUniqueResult=true) |
virtual wxString | GetSingleResultString (const wxString &strSQL, int nField, bool bRequireUniqueResult=true) |
Retrieve a single string value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false. More... | |
virtual wxString | GetSingleResultString (const wxString &strSQL, const wxString &strField, bool bRequireUniqueResult=true) |
virtual long | GetSingleResultLong (const wxString &strSQL, int nField, bool bRequireUniqueResult=true) |
Retrieve a single long value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false. More... | |
virtual long | GetSingleResultLong (const wxString &strSQL, const wxString &strField, bool bRequireUniqueResult=true) |
virtual bool | GetSingleResultBool (const wxString &strSQL, int nField, bool bRequireUniqueResult=true) |
Retrieve a single bool value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false. More... | |
virtual bool | GetSingleResultBool (const wxString &strSQL, const wxString &strField, bool bRequireUniqueResult=true) |
virtual wxDateTime | GetSingleResultDate (const wxString &strSQL, int nField, bool bRequireUniqueResult=true) |
Retrieve a single date/time value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false. More... | |
virtual wxDateTime | GetSingleResultDate (const wxString &strSQL, const wxString &strField, bool bRequireUniqueResult=true) |
virtual void * | GetSingleResultBlob (const wxString &strSQL, int nField, wxMemoryBuffer &Buffer, bool bRequireUniqueResult=true) |
Retrieve a single Blob value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false. More... | |
virtual void * | GetSingleResultBlob (const wxString &strSQL, const wxString &strField, wxMemoryBuffer &Buffer, bool bRequireUniqueResult=true) |
virtual double | GetSingleResultDouble (const wxString &strSQL, int nField, bool bRequireUniqueResult=true) |
Retrieve a single double value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false. More... | |
virtual double | GetSingleResultDouble (const wxString &strSQL, const wxString &strField, bool bRequireUniqueResult=true) |
virtual wxArrayInt | GetResultsArrayInt (const wxString &strSQL, int nField) |
Retrieve all the values of one field in a result set. More... | |
virtual wxArrayInt | GetResultsArrayInt (const wxString &strSQL, const wxString &Field) |
virtual wxArrayString | GetResultsArrayString (const wxString &strSQL, int nField) |
virtual wxArrayString | GetResultsArrayString (const wxString &strSQL, const wxString &Field) |
virtual wxArrayLong | GetResultsArrayLong (const wxString &strSQL, int nField) |
virtual wxArrayLong | GetResultsArrayLong (const wxString &strSQL, const wxString &Field) |
virtual wxArrayDouble | GetResultsArrayDouble (const wxString &strSQL, int nField) |
virtual wxArrayDouble | GetResultsArrayDouble (const wxString &strSQL, const wxString &Field) |
void | CloseResultSets () |
Close all result set objects that have been generated but not yet closed. More... | |
void | CloseStatements () |
Close all prepared statement objects that have been generated but not yet closed. More... | |
const wxString & | GetTypeName () |
Get a descriptive name for the type of database. More... | |
bool | IsViaODBC () |
Is the connection via ODBC. More... | |
const wxString & | GetLibraryPath () |
Get the library path required by the database. More... | |
Public Member Functions inherited from wxDatabaseErrorReporter | |
wxDatabaseErrorReporter () | |
virtual | ~wxDatabaseErrorReporter () |
const wxString & | GetErrorMessage () |
int | GetErrorCode () |
void | ResetErrorCodes () |
Public Member Functions inherited from wxDatabaseStringConverter | |
wxDatabaseStringConverter () | |
wxDatabaseStringConverter (const wxChar *charset) | |
virtual | ~wxDatabaseStringConverter () |
void | SetEncoding (wxFontEncoding encoding) |
void | SetEncoding (const wxCSConv *conv) |
const wxCSConv * | GetEncoding () |
virtual const wxCharBuffer | ConvertToUnicodeStream (const wxString &inputString) |
virtual size_t | GetEncodedStreamLength (const wxString &inputString) |
virtual wxString | ConvertFromUnicodeStream (const char *inputBuffer) |
virtual wxString | ConvertFromUnicodeStream (const wxChar *inputBuffer) |
Static Public Member Functions | |
static wxDatabase * | GetDatabase (wxConfigBase &config, wxString *err=NULL, const wxString &path="/") |
Get an instance of the first valid database specified in config. More... | |
Static Public Member Functions inherited from wxDatabaseStringConverter | |
static const wxCharBuffer | ConvertToUnicodeStream (const wxString &inputString, const char *encoding) |
static wxString | ConvertFromUnicodeStream (const char *inputBuffer, const char *encoding) |
static size_t | GetEncodedStreamLength (const wxString &inputString, const char *encoding) |
static wxString | ConvertFromUnicodeStream (const wxChar *inputBuffer, const char *encoding) |
Protected Member Functions | |
void | LogResultSetForCleanup (wxDatabaseResultSet *pResultSet) |
Add result set object pointer to the list for "garbage collection". More... | |
void | LogStatementForCleanup (wxPreparedStatement *pStatement) |
Add prepared statement object pointer to the list for "garbage collection". More... | |
Protected Member Functions inherited from wxDatabaseErrorReporter | |
void | SetErrorMessage (const wxString &strErrorMessage) |
void | SetErrorCode (int nErrorCode) |
void | ThrowDatabaseException () |
Private Member Functions | |
int | GetSingleResultInt (const wxString &strSQL, const wxVariant *field, bool bRequireUniqueResult=true) |
wxString | GetSingleResultString (const wxString &strSQL, const wxVariant *field, bool bRequireUniqueResult=true) |
long | GetSingleResultLong (const wxString &strSQL, const wxVariant *field, bool bRequireUniqueResult=true) |
bool | GetSingleResultBool (const wxString &strSQL, const wxVariant *field, bool bRequireUniqueResult=true) |
wxDateTime | GetSingleResultDate (const wxString &strSQL, const wxVariant *field, bool bRequireUniqueResult=true) |
void * | GetSingleResultBlob (const wxString &strSQL, const wxVariant *field, wxMemoryBuffer &Buffer, bool bRequireUniqueResult=true) |
double | GetSingleResultDouble (const wxString &strSQL, const wxVariant *field, bool bRequireUniqueResult=true) |
wxArrayInt | GetResultsArrayInt (const wxString &strSQL, const wxVariant *field) |
wxArrayString | GetResultsArrayString (const wxString &strSQL, const wxVariant *field) |
wxArrayLong | GetResultsArrayLong (const wxString &strSQL, const wxVariant *field) |
Private Attributes | |
wxDatabaseResultSetHashSet | m_ResultSets |
wxDatabaseStatementHashSet | m_Statements |
wxString | m_typeName |
bool | m_isViaODBC |
wxString | m_libraryPath |
wxDatabase::wxDatabase | ( | ) |
Constructor.
Definition at line 4 of file database.cpp.
|
virtual |
Destructor.
Definition at line 13 of file database.cpp.
References CloseResultSets(), and CloseStatements().
|
pure virtual |
Begin a transaction.
Implemented in wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, wxTdsDatabase, and wxSqliteDatabase.
|
inlinevirtual |
Reimplemented in wxMysqlDatabase.
Definition at line 26 of file database.h.
|
pure virtual |
close database
Implemented in wxPostgresDatabase, wxMysqlDatabase, wxOdbcDatabase, wxTdsDatabase, and wxSqliteDatabase.
|
virtual |
Close a result set returned by the database or a prepared statement previously.
Definition at line 52 of file database.cpp.
References wxPreparedStatement::CloseResultSet(), m_ResultSets, and m_Statements.
Referenced by GetResultsArrayInt(), GetResultsArrayLong(), GetResultsArrayString(), GetSingleResultBlob(), GetSingleResultBool(), GetSingleResultDate(), GetSingleResultDouble(), GetSingleResultInt(), GetSingleResultLong(), and GetSingleResultString().
void wxDatabase::CloseResultSets | ( | ) |
Close all result set objects that have been generated but not yet closed.
Definition at line 24 of file database.cpp.
References m_ResultSets.
Referenced by ~wxDatabase().
|
virtual |
Close a prepared statement previously prepared by the database.
Definition at line 95 of file database.cpp.
References m_Statements.
void wxDatabase::CloseStatements | ( | ) |
Close all prepared statement objects that have been generated but not yet closed.
Definition at line 38 of file database.cpp.
References m_Statements.
Referenced by ~wxDatabase().
|
pure virtual |
Commit the current transaction.
Implemented in wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, wxTdsDatabase, and wxSqliteDatabase.
|
inline |
See RunQueryWithResults.
Definition at line 64 of file database.h.
Referenced by GetResultsArrayInt(), GetResultsArrayLong(), GetResultsArrayString(), GetSingleResultBlob(), GetSingleResultBool(), GetSingleResultDate(), GetSingleResultDouble(), GetSingleResultInt(), GetSingleResultLong(), and GetSingleResultString().
|
inline |
See RunQuery.
Definition at line 62 of file database.h.
|
pure virtual |
Retrieve all column names for a table.
Implemented in wxTdsDatabase, wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, and wxSqliteDatabase.
|
static |
Get an instance of the first valid database specified in config.
Definition at line 922 of file database.cpp.
References m_isViaODBC, and m_typeName.
|
inline |
Get the library path required by the database.
Definition at line 157 of file database.h.
|
pure virtual |
get Primary keys column names
Implemented in wxTdsDatabase, wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, and wxSqliteDatabase.
|
virtual |
Definition at line 867 of file database.cpp.
Referenced by GetResultsArrayDouble().
|
virtual |
Definition at line 873 of file database.cpp.
References GetResultsArrayDouble().
|
virtual |
Retrieve all the values of one field in a result set.
Definition at line 708 of file database.cpp.
Referenced by GetResultsArrayInt().
|
virtual |
Definition at line 714 of file database.cpp.
References GetResultsArrayInt().
|
private |
Definition at line 720 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultInt(), and wxDatabaseResultSet::Next().
|
virtual |
Definition at line 814 of file database.cpp.
Referenced by GetResultsArrayLong().
|
virtual |
Definition at line 820 of file database.cpp.
References GetResultsArrayLong().
|
private |
Definition at line 826 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultLong(), and wxDatabaseResultSet::Next().
|
virtual |
Definition at line 761 of file database.cpp.
Referenced by GetResultsArrayString().
|
virtual |
Definition at line 767 of file database.cpp.
References GetResultsArrayString().
|
private |
Definition at line 773 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultString(), and wxDatabaseResultSet::Next().
|
virtual |
Retrieve a single Blob value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false.
Definition at line 540 of file database.cpp.
Referenced by GetSingleResultBlob().
|
virtual |
Definition at line 546 of file database.cpp.
References GetSingleResultBlob().
|
private |
Definition at line 552 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultBlob(), wxDatabaseResultSet::Next(), wxDatabaseErrorReporter::SetErrorCode(), wxDatabaseErrorReporter::SetErrorMessage(), wxDatabaseErrorReporter::ThrowDatabaseException(), wxDATABASE_NO_ROWS_FOUND, and wxDATABASE_NON_UNIQUE_RESULTSET.
|
virtual |
Retrieve a single bool value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false.
Definition at line 372 of file database.cpp.
Referenced by GetSingleResultBool().
|
virtual |
Definition at line 378 of file database.cpp.
References GetSingleResultBool().
|
private |
Definition at line 384 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultBool(), wxDatabaseResultSet::Next(), wxDatabaseErrorReporter::SetErrorCode(), wxDatabaseErrorReporter::SetErrorMessage(), wxDatabaseErrorReporter::ThrowDatabaseException(), wxDATABASE_NO_ROWS_FOUND, and wxDATABASE_NON_UNIQUE_RESULTSET.
|
virtual |
Retrieve a single date/time value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false.
Definition at line 456 of file database.cpp.
Referenced by GetSingleResultDate().
|
virtual |
Definition at line 462 of file database.cpp.
References GetSingleResultDate().
|
private |
Definition at line 468 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultDate(), wxDatabaseResultSet::Next(), wxDatabaseErrorReporter::SetErrorCode(), wxDatabaseErrorReporter::SetErrorMessage(), wxDatabaseErrorReporter::ThrowDatabaseException(), wxDATABASE_NO_ROWS_FOUND, and wxDATABASE_NON_UNIQUE_RESULTSET.
|
virtual |
Retrieve a single double value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false.
Definition at line 624 of file database.cpp.
Referenced by GetSingleResultDouble().
|
virtual |
Definition at line 630 of file database.cpp.
References GetSingleResultDouble().
|
private |
Definition at line 636 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultDouble(), wxDatabaseResultSet::Next(), wxDatabaseErrorReporter::SetErrorCode(), wxDatabaseErrorReporter::SetErrorMessage(), wxDatabaseErrorReporter::ThrowDatabaseException(), wxDATABASE_NO_ROWS_FOUND, and wxDATABASE_NON_UNIQUE_RESULTSET.
|
virtual |
With the GetSingleResultX API, two additional exception types are thrown: wxDATABASE_NO_ROWS_FOUND - No database rows were returned wxDATABASE_NON_UNIQUE_RESULTSET - More than one database row was returned.
Retrieve a single integer value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false
Definition at line 126 of file database.cpp.
Referenced by GetSingleResultInt().
|
virtual |
Definition at line 120 of file database.cpp.
References GetSingleResultInt().
|
private |
Definition at line 132 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultInt(), wxDatabaseResultSet::Next(), wxDatabaseErrorReporter::SetErrorCode(), wxDatabaseErrorReporter::SetErrorMessage(), wxDatabaseErrorReporter::ThrowDatabaseException(), wxDATABASE_NO_ROWS_FOUND, and wxDATABASE_NON_UNIQUE_RESULTSET.
|
virtual |
Retrieve a single long value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false.
Definition at line 288 of file database.cpp.
Referenced by GetSingleResultLong().
|
virtual |
Definition at line 294 of file database.cpp.
References GetSingleResultLong().
|
private |
Definition at line 300 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultLong(), wxDatabaseResultSet::Next(), wxDatabaseErrorReporter::SetErrorCode(), wxDatabaseErrorReporter::SetErrorMessage(), wxDatabaseErrorReporter::ThrowDatabaseException(), wxDATABASE_NO_ROWS_FOUND, and wxDATABASE_NON_UNIQUE_RESULTSET.
|
virtual |
Retrieve a single string value from a query If multiple records are returned from the query, a wxDATABASE_NON_UNIQUE_RESULTSET exception is thrown unless bRequireUniqueResult is false.
Definition at line 204 of file database.cpp.
Referenced by GetSingleResultString().
|
virtual |
Definition at line 210 of file database.cpp.
References GetSingleResultString().
|
private |
Definition at line 216 of file database.cpp.
References CloseResultSet(), ExecuteQuery(), wxDatabaseResultSet::GetResultString(), wxDatabaseResultSet::Next(), wxDatabaseErrorReporter::SetErrorCode(), wxDatabaseErrorReporter::SetErrorMessage(), wxDatabaseErrorReporter::ThrowDatabaseException(), wxDATABASE_NO_ROWS_FOUND, and wxDATABASE_NON_UNIQUE_RESULTSET.
|
pure virtual |
Retrieve all table names.
Implemented in wxTdsDatabase, wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, and wxSqliteDatabase.
|
inline |
Get a descriptive name for the type of database.
Definition at line 149 of file database.h.
|
pure virtual |
Retrieve all view names.
Implemented in wxTdsDatabase, wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, and wxSqliteDatabase.
|
pure virtual |
Is the connection to the database open?
Implemented in wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, wxTdsDatabase, and wxSqliteDatabase.
|
inline |
Is the connection via ODBC.
Definition at line 153 of file database.h.
|
inlineprotected |
Add result set object pointer to the list for "garbage collection".
Definition at line 181 of file database.h.
|
inlineprotected |
Add prepared statement object pointer to the list for "garbage collection".
Definition at line 183 of file database.h.
|
pure virtual |
Implemented in wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, wxTdsDatabase, and wxSqliteDatabase.
|
pure virtual |
Prepare a SQL statement which can be reused with different parameters.
Implemented in wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, wxTdsDatabase, and wxSqliteDatabase.
|
pure virtual |
Rollback the current transaction.
Implemented in wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, wxTdsDatabase, and wxSqliteDatabase.
|
virtual |
Run an insert, update, or delete query on the database.
Definition at line 19 of file database.cpp.
|
pure virtual |
Run an insert, update, or delete query on the database.
Implemented in wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, wxTdsDatabase, and wxSqliteDatabase.
|
pure virtual |
Run a select query on the database.
Implemented in wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, wxTdsDatabase, and wxSqliteDatabase.
|
pure virtual |
Check for the existence of a table by name.
Implemented in wxTdsDatabase, wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, and wxSqliteDatabase.
|
pure virtual |
Check for the existence of a view by name.
Implemented in wxTdsDatabase, wxMysqlDatabase, wxPostgresDatabase, wxOdbcDatabase, and wxSqliteDatabase.
|
private |
Definition at line 204 of file database.h.
Referenced by GetDatabase().
|
private |
Definition at line 205 of file database.h.
|
private |
Definition at line 200 of file database.h.
Referenced by CloseResultSet(), and CloseResultSets().
|
private |
Definition at line 201 of file database.h.
Referenced by CloseResultSet(), CloseStatement(), and CloseStatements().
|
private |
Definition at line 203 of file database.h.
Referenced by GetDatabase().