Version: 1.0.0
postgresql_preparedstatement.h
Go to the documentation of this file.
1 #ifndef _WX_DATABASE_POSTGRESQL_PREPARED_STATEMENT_H_
2 #define _WX_DATABASE_POSTGRESQL_PREPARED_STATEMENT_H_
3 
4 #include "wx/database/wxprec.h"
6 
7 WX_DECLARE_OBJARRAY(wxPostgresPreparedStatementWrapper, ArrayOfPostgresPreparedStatementWrappers);
8 
10 {
11 public:
12  // ctor
14  wxPostgresPreparedStatement(wxDynamicPostgresInterface* pInterface, PGconn* pDatabase, const wxString& strSQL, const wxString& strStatementName);
15 
16  // dtor
18 
19  virtual void Close();
20 
21  void AddStatement(PGconn* pDatabase, const wxString& strSQL, const wxString& strStatementName);
22  static wxPostgresPreparedStatement* CreateStatement(wxDynamicPostgresInterface* pInterface, PGconn* pDatabase, const wxString& strSQL);
23 
24  // set field
25  virtual void SetParamInt(int nPosition, int nValue);
26  virtual void SetParamDouble(int nPosition, double dblValue);
27  virtual void SetParamString(int nPosition, const wxString& strValue);
28  virtual void SetParamNull(int nPosition);
29  virtual void SetParamBlob(int nPosition, const void* pData, long nDataLength);
30  virtual void SetParamDate(int nPosition, const wxDateTime& dateValue);
31  virtual void SetParamBool(int nPosition, bool bValue);
32  virtual int GetParameterCount();
33 
34  virtual int RunQuery();
36 
37  static wxString TranslateSQL(const wxString& strOriginalSQL);
38 
39 private:
41  int FindStatementAndAdjustPositionIndex(int* pPosition);
42  static wxString GenerateRandomStatementName();
43 
44  ArrayOfPostgresPreparedStatementWrappers m_Statements;
45 };
46 
47 #endif//_WX_DATABASE_POSTGRESQL_PREPARED_STATEMENT_H_
48 
wxPostgresPreparedStatement(wxDynamicPostgresInterface *pInterface)
virtual void SetParamBool(int nPosition, bool bValue)
Set the parameter at the 1-based position to a boolean value.
static wxPostgresPreparedStatement * CreateStatement(wxDynamicPostgresInterface *pInterface, PGconn *pDatabase, const wxString &strSQL)
virtual int GetParameterCount()
ArrayOfPostgresPreparedStatementWrappers m_Statements
void AddStatement(PGconn *pDatabase, const wxString &strSQL, const wxString &strStatementName)
WX_DECLARE_OBJARRAY(wxPostgresPreparedStatementWrapper, ArrayOfPostgresPreparedStatementWrappers)
static wxString TranslateSQL(const wxString &strOriginalSQL)
virtual wxDatabaseResultSet * RunQueryWithResults()
Run an insert, update, or delete query on the database.
virtual void Close()
Close the result set (call wxDatabase::ClosePreparedStatement() instead on the statement)
virtual void SetParamString(int nPosition, const wxString &strValue)
Set the parameter at the 1-based position to a wxString value.
virtual void SetParamDouble(int nPosition, double dblValue)
Set the parameter at the 1-based position to a double value.
virtual ~wxPostgresPreparedStatement()
static wxString GenerateRandomStatementName()
wxDynamicPostgresInterface * m_pInterface
int FindStatementAndAdjustPositionIndex(int *pPosition)
virtual void SetParamDate(int nPosition, const wxDateTime &dateValue)
Set the parameter at the 1-based position to a wxDateTime value.
virtual int RunQuery()
Run an insert, update, or delete query on the database.
virtual void SetParamNull(int nPosition)
Set the parameter at the 1-based position to a NULL value.
virtual void SetParamBlob(int nPosition, const void *pData, long nDataLength)
Set the parameter at the 1-based position to a Blob value.
virtual void SetParamInt(int nPosition, int nValue)
Set the parameter at the 1-based position to an int value.