Version: 1.0.0
wxPostgresDatabase Class Reference

#include <postgresql_database.h>

+ Inheritance diagram for wxPostgresDatabase:

Detailed Description

Definition at line 11 of file postgresql_database.h.

Public Member Functions

 wxPostgresDatabase ()
 
 wxPostgresDatabase (const wxString &strDatabase)
 
 wxPostgresDatabase (const wxString &strServer, const wxString &strDatabase)
 
 wxPostgresDatabase (const wxString &strDatabase, const wxString &strUser, const wxString &strPassword)
 
 wxPostgresDatabase (const wxString &strServer, const wxString &strDatabase, const wxString &strUser, const wxString &strPassword)
 
 wxPostgresDatabase (const wxString &strServer, int nPort, const wxString &strDatabase, const wxString &strUser, const wxString &strPassword)
 
 wxPostgresDatabase (void *pDatabase)
 
virtual ~wxPostgresDatabase ()
 
virtual bool Open ()
 
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 Open (const wxString &strServer, int nPort, const wxString &strDatabase, const wxString &strUser, const wxString &strPassword)
 
virtual bool Close ()
 close database More...
 
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...
 
void SetPort (int nPort)
 
- Public Member Functions inherited from wxDatabase
 wxDatabase ()
 Constructor. More...
 
virtual ~wxDatabase ()
 Destructor. More...
 
virtual bool ChangeDatabase (const wxString &database)
 
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 Attributes

wxDynamicPostgresInterfacem_pInterface
 
wxString m_strServer
 
wxString m_strDatabase
 
wxString m_strUser
 
wxString m_strPassword
 
wxString m_strPort
 
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

◆ wxPostgresDatabase() [1/7]

wxPostgresDatabase::wxPostgresDatabase ( )

◆ wxPostgresDatabase() [2/7]

wxPostgresDatabase::wxPostgresDatabase ( const wxString &  strDatabase)

◆ wxPostgresDatabase() [3/7]

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

◆ wxPostgresDatabase() [4/7]

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

◆ wxPostgresDatabase() [5/7]

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

◆ wxPostgresDatabase() [6/7]

wxPostgresDatabase::wxPostgresDatabase ( const wxString &  strServer,
int  nPort,
const wxString &  strDatabase,
const wxString &  strUser,
const wxString &  strPassword 
)

◆ wxPostgresDatabase() [7/7]

wxPostgresDatabase::wxPostgresDatabase ( void *  pDatabase)
inline

Definition at line 27 of file postgresql_database.h.

◆ ~wxPostgresDatabase()

virtual wxPostgresDatabase::~wxPostgresDatabase ( )
virtual

Member Function Documentation

◆ BeginTransaction()

virtual void wxPostgresDatabase::BeginTransaction ( )
virtual

Begin a transaction.

Implements wxDatabase.

◆ Close()

virtual bool wxPostgresDatabase::Close ( )
virtual

close database

Implements wxDatabase.

◆ Commit()

virtual void wxPostgresDatabase::Commit ( )
virtual

Commit the current transaction.

Implements wxDatabase.

◆ GetColumns()

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

Retrieve all column names for a table.

Implements wxDatabase.

◆ GetPKColumns()

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

get Primary keys column names

Implements wxDatabase.

◆ GetTables()

virtual wxArrayString wxPostgresDatabase::GetTables ( )
virtual

Retrieve all table names.

Implements wxDatabase.

◆ GetViews()

virtual wxArrayString wxPostgresDatabase::GetViews ( )
virtual

Retrieve all view names.

Implements wxDatabase.

◆ IsAvailable()

static bool wxPostgresDatabase::IsAvailable ( )
static

◆ IsOpen()

virtual bool wxPostgresDatabase::IsOpen ( )
virtual

Is the connection to the database open?

Implements wxDatabase.

◆ Open() [1/6]

virtual bool wxPostgresDatabase::Open ( )
virtual

◆ Open() [2/6]

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

Implements wxDatabase.

◆ Open() [3/6]

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

◆ Open() [4/6]

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

◆ Open() [5/6]

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

◆ Open() [6/6]

virtual bool wxPostgresDatabase::Open ( const wxString &  strServer,
int  nPort,
const wxString &  strDatabase,
const wxString &  strUser,
const wxString &  strPassword 
)
virtual

◆ PrepareStatement()

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

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

Implements wxDatabase.

◆ RollBack()

virtual void wxPostgresDatabase::RollBack ( )
virtual

Rollback the current transaction.

Implements wxDatabase.

◆ RunQuery()

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

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

Implements wxDatabase.

◆ RunQueryWithResults()

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

Run a select query on the database.

Implements wxDatabase.

◆ SetPort()

void wxPostgresDatabase::SetPort ( int  nPort)

◆ TableExists()

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

Check for the existence of a table by name.

Implements wxDatabase.

◆ TranslateErrorCode()

static int wxPostgresDatabase::TranslateErrorCode ( int  nCode)
static

◆ ViewExists()

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

Check for the existence of a view by name.

Implements wxDatabase.

Member Data Documentation

◆ m_pDatabase

void* wxPostgresDatabase::m_pDatabase
private

Definition at line 81 of file postgresql_database.h.

◆ m_pInterface

wxDynamicPostgresInterface* wxPostgresDatabase::m_pInterface
private

Definition at line 73 of file postgresql_database.h.

◆ m_strDatabase

wxString wxPostgresDatabase::m_strDatabase
private

Definition at line 76 of file postgresql_database.h.

◆ m_strPassword

wxString wxPostgresDatabase::m_strPassword
private

Definition at line 78 of file postgresql_database.h.

◆ m_strPort

wxString wxPostgresDatabase::m_strPort
private

Definition at line 79 of file postgresql_database.h.

◆ m_strServer

wxString wxPostgresDatabase::m_strServer
private

Definition at line 75 of file postgresql_database.h.

◆ m_strUser

wxString wxPostgresDatabase::m_strUser
private

Definition at line 77 of file postgresql_database.h.