Version: 1.0.0
prepared_statement.h
Go to the documentation of this file.
1 #ifndef _WX_DATABASE_PREPARED_STATEMENT_H_
2 #define _WX_DATABASE_PREPARED_STATEMENT_H_
3 
4 #include "wx/database/wxprec.h"
5 
6 WX_DECLARE_HASH_SET( wxDatabaseResultSet*, wxPointerHash, wxPointerEqual, StatementResultSetHashSet );
7 
9 {
10 public:
13 
15  virtual ~wxPreparedStatement();
16 
18  virtual void Close() = 0;
19 
20  // set parameters
22  virtual void SetParamInt(int nPosition, int nValue) = 0;
24  virtual void SetParamDouble(int nPosition, double dblValue) = 0;
26  virtual void SetParamString(int nPosition, const wxString& strValue) = 0;
28  virtual void SetParamNull(int nPosition) = 0;
30  virtual void SetParamBlob(int nPosition, const wxMemoryBuffer& buffer);
32  virtual void SetParamBlob(int nPosition, const void* pData, long nDataLength) = 0;
34  virtual void SetParamDate(int nPosition, const wxDateTime& dateValue) = 0;
36  virtual void SetParamBool(int nPosition, bool bValue) = 0;
37  virtual int GetParameterCount() = 0;
38 
40  virtual int RunQuery() = 0;
42  virtual wxDatabaseResultSet* RunQueryWithResults() = 0;
43 
44  // function names more consistent with JDBC and wxSQLite3
45  // these just provide wrappers for existing functions
47  int ExecuteUpdate() { return RunQuery(); }
49  wxDatabaseResultSet* ExecuteQuery() { return RunQueryWithResults(); }
50 
52  virtual bool CloseResultSet(wxDatabaseResultSet* pResultSet);
53 
54 protected:
56  void CloseResultSets();
58  void LogResultSetForCleanup(wxDatabaseResultSet* pResultSet) { m_ResultSets.insert(pResultSet); }
59 
60 private:
61  StatementResultSetHashSet m_ResultSets;
62 };
63 
64 #endif//_WX_DATABASE_PREPARED_STATEMENT_H_
65 
wxDatabaseResultSet * ExecuteQuery()
See RunQueryWithResults.
void LogResultSetForCleanup(wxDatabaseResultSet *pResultSet)
Add result set object pointer to the list for "garbage collection".
WX_DECLARE_HASH_SET(wxDatabaseResultSet *, wxPointerHash, wxPointerEqual, StatementResultSetHashSet)
StatementResultSetHashSet m_ResultSets
#define WXDLLIMPEXP_DATABASE
int ExecuteUpdate()
See RunQuery.