RowSet.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace AppSecInc
4 {
5  namespace Databases
6  {
7  namespace ODBC
8  {
10  class ODBCRowSet
11  {
12  private:
14  ODBCHandle _stmt;
16  std::vector<ODBCColumn *> _columns;
18  std::map<std::wstring, ODBCColumn *> _columnmap;
20  std::vector<ODBCDiagnosticsMessage> _messages;
22  ODBCRowSet& operator=(const ODBCRowSet& value) { };
23  public:
25  const std::vector<ODBCDiagnosticsMessage>& GetMessages() const { return _messages; }
27  unsigned int GetColumnCount() const { return _columns.size(); }
29  const ODBCColumn * operator[](const std::wstring& name) const;
31  const ODBCColumn * operator[](int index) const;
33  const ODBCHandle& PeekStatementHandle() const { return _stmt; }
35  void AddColumn(const std::wstring& name, int type, int size = ODBCColumn::INVALID_SIZE);
37  void Bind(SQLHANDLE hconn);
39  void BindColumns();
42  bool Fetch();
44  void ExecuteDirect(const std::wstring& query);
46  void Prepare(const std::wstring& query);
48  void Execute();
50  std::wstring GetError() const { return _stmt.GetError(); }
52  std::vector<ODBCError> GetErrors() const { return _stmt.GetErrors(); }
54  SQLSMALLINT GetNumResultCols() const;
57  SQLINTEGER GetSQLRowCount() const;
58  ODBCRowSet();
59  virtual ~ODBCRowSet();
60  };
61  }
62  }
63 }
SQLSMALLINT GetNumResultCols() const
get the actual column count in the result set
Definition: RowSet.cpp:168
SQLINTEGER GetSQLRowCount() const
Definition: RowSet.cpp:179
const std::vector< ODBCDiagnosticsMessage > & GetMessages() const
get the executed statement messages
Definition: RowSet.h:25
void BindColumns()
bind columns
Definition: RowSet.cpp:60
static const SQLINTEGER INVALID_SIZE
invalid data size
Definition: Buffer.h:23
static std::vector< ODBCError > GetErrors(SQLHANDLE handle, int type)
get an array of errors on an ODBC handle
Definition: Handle.cpp:132
bool Fetch()
Definition: RowSet.cpp:145
ODBCRowSet()
Definition: RowSet.cpp:6
An ODBC rowset.
Definition: RowSet.h:10
virtual ~ODBCRowSet()
Definition: RowSet.cpp:11
An ODBC handle (smart pointer), bound to a connection.
Definition: Handle.h:31
std::vector< ODBCError > GetErrors() const
get an array of errors on the current ODBC connection
Definition: RowSet.h:52
void ExecuteDirect(const std::wstring &query)
execute the query
Definition: RowSet.cpp:134
unsigned int GetColumnCount() const
get the number of columns
Definition: RowSet.h:27
void Prepare(const std::wstring &query)
execute the query
Definition: RowSet.cpp:125
std::wstring GetError() const
get the text representation of the errors on an ODBC connection handle
Definition: RowSet.h:50
const ODBCColumn * operator[](const std::wstring &name) const
get a column by name
Definition: RowSet.cpp:37
void Bind(SQLHANDLE hconn)
bind the rowset to a connection
Definition: RowSet.cpp:55
static std::wstring GetError(SQLHANDLE handle, int type)
get the text representation of the errors on an ODBC handle
Definition: Handle.cpp:158
const ODBCHandle & PeekStatementHandle() const
get the statement handle
Definition: RowSet.h:33
An ODBC column.
Definition: Column.h:10
void Execute()
execute the query
Definition: RowSet.cpp:98
void AddColumn(const std::wstring &name, int type, int size=ODBCColumn::INVALID_SIZE)
add a named column with a defined type and initial size
Definition: RowSet.cpp:20


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com