Version: 1.0.0
wxMysqlDatabase Class Reference

#include <mysql_database.h>

+ Inheritance diagram for wxMysqlDatabase:

Detailed Description

Definition at line 13 of file mysql_database.h.

Public Member Functions

 wxMysqlDatabase ()
 
 wxMysqlDatabase (const wxString &strDatabase)
 
 wxMysqlDatabase (const wxString &strServer, const wxString &strDatabase)
 
 wxMysqlDatabase (const wxString &strDatabase, const wxString &strUser, const wxString &strPassword)
 
 wxMysqlDatabase (const wxString &strServer, const wxString &strDatabase, const wxString &strUser, const wxString &strPassword)
 
 wxMysqlDatabase (void *pDatabase)
 
virtual ~wxMysqlDatabase ()
 
virtual bool Open (const wxString &strDatabase)
 
virtual bool Open (const wxString &strServer, const wxString &strDatabase)
 
virtual bool Open (const wxString &strDatabase, const wxString &strUser, const wxString &strPassword)
 
virtual bool Open (const wxString &strServer, const wxString &strDatabase, const wxString &strUser, const wxString &strPassword)
 
virtual bool Close ()
 close database More...
 
virtual bool ChangeDatabase (const wxString &database)
 
virtual bool IsOpen ()
 Is the connection to the database open? More...
 
virtual void BeginTransaction ()
 Begin a transaction. More...
 
virtual void Commit ()
 Commit the current transaction. More...
 
virtual void RollBack ()
 Rollback the current transaction. More...
 
virtual int RunQuery (const wxString &strQuery, bool bParseQuery)
 Run an insert, update, or delete query on the database. More...
 
virtual wxDatabaseResultSetRunQueryWithResults (const wxString &strQuery)
 Run a select query on the database. More...
 
virtual wxPreparedStatementPrepareStatement (const wxString &strQuery)
 Prepare a SQL statement which can be reused with different parameters. More...
 
virtual bool TableExists (const wxString &table)
 Check for the existence of a table by name. More...
 
virtual bool ViewExists (const wxString &view)
 Check for the existence of a view by name. More...
 
virtual wxArrayString GetTables ()
 Retrieve all table names. More...
 
virtual wxArrayString GetViews ()
 Retrieve all view names. More...
 
virtual wxArrayString GetColumns (const wxString &table)
 Retrieve all column names for a table. More...
 
virtual wxArrayString GetPKColumns (const wxString &table)
 get Primary keys column names More...
 
- Public Member Functions inherited from wxDatabase
 wxDatabase ()
 Constructor. More...
 
virtual ~wxDatabase ()
 Destructor. More...
 
virtual int RunQuery (const wxString &strQuery)
 Run an insert, update, or delete 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 bool CloseStatement (wxPreparedStatement *pStatement)
 Close a prepared statement previously prepared by the database. More...
 
int ExecuteUpdate (const wxString &strQuery)
 See RunQuery. More...
 
wxDatabaseResultSetExecuteQuery (const wxString &strQuery)
 See RunQueryWithResults. 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 int TranslateErrorCode (int nCode)
 
static bool IsAvailable ()
 
- Static Public Member Functions inherited from wxDatabase
static wxDatabaseGetDatabase (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)
 

Private Member Functions

void InitDatabase ()
 
void ParseServerAndPort (const wxString &strServer)
 

Private Attributes

wxMysqlDynamicInterfacem_pInterface
 
wxString m_strServer
 
wxString m_strDatabase
 
wxString m_strUser
 
wxString m_strPassword
 
int m_iPort
 
void * m_pDatabase
 

Additional Inherited Members

- Protected Member Functions inherited from wxDatabase
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 ()
 

Constructor & Destructor Documentation

◆ wxMysqlDatabase() [1/6]

wxMysqlDatabase::wxMysqlDatabase ( )

◆ wxMysqlDatabase() [2/6]

wxMysqlDatabase::wxMysqlDatabase ( const wxString &  strDatabase)

◆ wxMysqlDatabase() [3/6]

wxMysqlDatabase::wxMysqlDatabase ( const wxString &  strServer,
const wxString &  strDatabase 
)

◆ wxMysqlDatabase() [4/6]

wxMysqlDatabase::wxMysqlDatabase ( const wxString &  strDatabase,
const wxString &  strUser,
const wxString &  strPassword 
)

◆ wxMysqlDatabase() [5/6]

wxMysqlDatabase::wxMysqlDatabase ( const wxString &  strServer,
const wxString &  strDatabase,
const wxString &  strUser,
const wxString &  strPassword 
)

◆ wxMysqlDatabase() [6/6]

wxMysqlDatabase::wxMysqlDatabase ( void *  pDatabase)
inline

Definition at line 28 of file mysql_database.h.

◆ ~wxMysqlDatabase()

virtual wxMysqlDatabase::~wxMysqlDatabase ( )
virtual

Member Function Documentation

◆ BeginTransaction()

virtual void wxMysqlDatabase::BeginTransaction ( )
virtual

Begin a transaction.

Implements wxDatabase.

◆ ChangeDatabase()

virtual bool wxMysqlDatabase::ChangeDatabase ( const wxString &  database)
virtual

Reimplemented from wxDatabase.

◆ Close()

virtual bool wxMysqlDatabase::Close ( )
virtual

close database

Implements wxDatabase.

◆ Commit()

virtual void wxMysqlDatabase::Commit ( )
virtual

Commit the current transaction.

Implements wxDatabase.

◆ GetColumns()

virtual wxArrayString wxMysqlDatabase::GetColumns ( const wxString &  table)
virtual

Retrieve all column names for a table.

Implements wxDatabase.

◆ GetPKColumns()

virtual wxArrayString wxMysqlDatabase::GetPKColumns ( const wxString &  table)
virtual

get Primary keys column names

Implements wxDatabase.

◆ GetTables()

virtual wxArrayString wxMysqlDatabase::GetTables ( )
virtual

Retrieve all table names.

Implements wxDatabase.

◆ GetViews()

virtual wxArrayString wxMysqlDatabase::GetViews ( )
virtual

Retrieve all view names.

Implements wxDatabase.

◆ InitDatabase()

void wxMysqlDatabase::InitDatabase ( )
private

◆ IsAvailable()

static bool wxMysqlDatabase::IsAvailable ( )
static

◆ IsOpen()

virtual bool wxMysqlDatabase::IsOpen ( )
virtual

Is the connection to the database open?

Implements wxDatabase.

◆ Open() [1/4]

virtual bool wxMysqlDatabase::Open ( const wxString &  strDatabase)
virtual

Implements wxDatabase.

◆ Open() [2/4]

virtual bool wxMysqlDatabase::Open ( const wxString &  strServer,
const wxString &  strDatabase 
)
virtual

◆ Open() [3/4]

virtual bool wxMysqlDatabase::Open ( const wxString &  strDatabase,
const wxString &  strUser,
const wxString &  strPassword 
)
virtual

◆ Open() [4/4]

virtual bool wxMysqlDatabase::Open ( const wxString &  strServer,
const wxString &  strDatabase,
const wxString &  strUser,
const wxString &  strPassword 
)
virtual

◆ ParseServerAndPort()

void wxMysqlDatabase::ParseServerAndPort ( const wxString &  strServer)
private

◆ PrepareStatement()

virtual wxPreparedStatement* wxMysqlDatabase::PrepareStatement ( const wxString &  strQuery)
virtual

Prepare a SQL statement which can be reused with different parameters.

Implements wxDatabase.

◆ RollBack()

virtual void wxMysqlDatabase::RollBack ( )
virtual

Rollback the current transaction.

Implements wxDatabase.

◆ RunQuery()

virtual int wxMysqlDatabase::RunQuery ( const wxString &  strQuery,
bool  bParseQueries 
)
virtual

Run an insert, update, or delete query on the database.

Implements wxDatabase.

◆ RunQueryWithResults()

virtual wxDatabaseResultSet* wxMysqlDatabase::RunQueryWithResults ( const wxString &  strQuery)
virtual

Run a select query on the database.

Implements wxDatabase.

◆ TableExists()

virtual bool wxMysqlDatabase::TableExists ( const wxString &  table)
virtual

Check for the existence of a table by name.

Implements wxDatabase.

◆ TranslateErrorCode()

static int wxMysqlDatabase::TranslateErrorCode ( int  nCode)
static

◆ ViewExists()

virtual bool wxMysqlDatabase::ViewExists ( const wxString &  view)
virtual

Check for the existence of a view by name.

Implements wxDatabase.

Member Data Documentation

◆ m_iPort

int wxMysqlDatabase::m_iPort
private

Definition at line 83 of file mysql_database.h.

◆ m_pDatabase

void* wxMysqlDatabase::m_pDatabase
private

Definition at line 85 of file mysql_database.h.

◆ m_pInterface

wxMysqlDynamicInterface* wxMysqlDatabase::m_pInterface
private

Definition at line 77 of file mysql_database.h.

◆ m_strDatabase

wxString wxMysqlDatabase::m_strDatabase
private

Definition at line 80 of file mysql_database.h.

◆ m_strPassword

wxString wxMysqlDatabase::m_strPassword
private

Definition at line 82 of file mysql_database.h.

◆ m_strServer

wxString wxMysqlDatabase::m_strServer
private

Definition at line 79 of file mysql_database.h.

◆ m_strUser

wxString wxMysqlDatabase::m_strUser
private

Definition at line 81 of file mysql_database.h.