Version: 1.0.0
odbc_resultset.h
Go to the documentation of this file.
1 #ifndef _WX_DATABASE_ODBC_RESULT_SET_H_
2 #define _WX_DATABASE_ODBC_RESULT_SET_H_
3 
4 #include "wx/database/wxprec.h"
5 
7 class wxOdbcDatabase;
8 
9 WX_DECLARE_OBJARRAY(wxVariant, ValuesArray);
10 WX_DECLARE_HASH_SET( int, wxIntegerHash, wxIntegerEqual, IntegerSet );
11 WX_DECLARE_HASH_MAP( int, wxMemoryBuffer, wxIntegerHash, wxIntegerEqual, BlobMap );
12 
14 {
15 public:
16  // ctor
17  wxOdbcResultSet(wxOdbcInterface* pInterface);
18  wxOdbcResultSet(wxOdbcInterface* pInterface, wxOdbcPreparedStatement* pStatement, bool bManageStatement = false, int nCol = 0);
19 
20  // dtor
21  virtual ~wxOdbcResultSet();
22 
23  virtual bool Next();
24  virtual void Close();
25 
26  // get field
27  virtual int GetResultInt(int nField);
28  virtual wxString GetResultString(int nField);
29  virtual long GetResultLong(int nField);
30  virtual bool GetResultBool(int nField);
31  virtual wxDateTime GetResultDate(int nField);
32  virtual void* GetResultBlob(int nField, wxMemoryBuffer& Buffer);
33  virtual double GetResultDouble(int nField);
34  virtual bool IsFieldNull(int nField);
35  virtual int GetFieldLength(int nField);
36 
37  virtual int GetFieldLength(const wxString& strField);
38 
39  // get MetaData
41 
42 private:
43  void RetrieveFieldData(int nField);
44  void InterpretErrorCodes( long nCode, SQLHSTMT stmth_ptr=NULL );
45  virtual int LookupField(const wxString& strField);
46  bool IsBlob(int nField);
47 
49  SQLHSTMT m_pOdbcStatement;
50 
51  StringToIntMap m_FieldLookupMap;
52  ValuesArray m_fieldValues;
53  // List of values that have been retrieved
54  IntegerSet m_RetrievedValues;
55  // List of values that are NULL
56  IntegerSet m_NullValues;
57 
59  SQLHSTMT m_pHStmt;
61 
62  BlobMap m_BlobMap;
63 };
64 
65 #endif//_WX_DATABASE_ODBC_RESULT_SET_H_
66 
StringToIntMap m_FieldLookupMap
virtual void Close()
Close the result set (call wxDatabase::CloseResultSet() instead on the result set)
IntegerSet m_RetrievedValues
virtual wxResultSetMetaData * GetMetaData()
Retrieve the MetaData associated with this result set.
virtual bool IsFieldNull(int nField)
Check if a field in the current result set record is NULL.
virtual long GetResultLong(int nField)
Retrieve a long from the result set by the 1-based field index.
virtual void * GetResultBlob(int nField, wxMemoryBuffer &Buffer)
Retrieve a BLOB from the result set by the 1-based field index.
WX_DECLARE_OBJARRAY(wxVariant, ValuesArray)
wxOdbcPreparedStatement * m_pStatement
void RetrieveFieldData(int nField)
ValuesArray m_fieldValues
virtual bool Next()
Move to the next record in the result set.
IntegerSet m_NullValues
WX_DECLARE_HASH_MAP(int, wxMemoryBuffer, wxIntegerHash, wxIntegerEqual, BlobMap)
wxOdbcInterface * m_pInterface
WX_DECLARE_HASH_SET(int, wxIntegerHash, wxIntegerEqual, IntegerSet)
virtual double GetResultDouble(int nField)
Retrieve a double from the result set by the 1-based field index.
virtual wxString GetResultString(int nField)
Retrieve a wxString from the result set by the 1-based field index.
virtual bool GetResultBool(int nField)
Retrieve a boolean from the result set by the 1-based field index.
virtual wxDateTime GetResultDate(int nField)
Retrieve a wxDateTime from the result set by the 1-based field index.
virtual int LookupField(const wxString &strField)
virtual int GetResultInt(int nField)
Retrieve an integer from the result set by the 1-based field index.
SQLHSTMT m_pOdbcStatement
wxOdbcResultSet(wxOdbcInterface *pInterface)
virtual ~wxOdbcResultSet()
void InterpretErrorCodes(long nCode, SQLHSTMT stmth_ptr=NULL)
virtual int GetFieldLength(int nField)
bool IsBlob(int nField)