1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef RESULT_SET_H
#define RESULT_SET_H
#include <windows.h>
#include <sql.h>
#include <sqlext.h>
#include <string>
#include "apache/das/rdb/StatementPtr.h"
#include "apache/das/RefCountingObject.h"
#include "apache/das/rdb/ResultSetMetaData.h"
#include "apache/das/rdb/DASInvalidSQLTypeException.h"
namespace apache {
namespace das {
namespace rdb {
class Statement;
class ResultSetMetaData;
class ResultSet;
typedef RefCountingObject<ResultSet> ResultSetObject;
class ResultSet : public ResultSetObject {
private:
ResultSetMetaData* metaData;
StatementPtr stmt;
std::string getSQLString(unsigned int columnIndex) const;
std::wstring getSQLWString(unsigned int columnIndex) const;
public:
ResultSet(StatementPtr aStmt);
virtual ~ResultSet(void);
const ResultSetMetaData& getResultSetMetaData(void) const;
StatementPtr getStatement(void) const;
SQLCHAR getSQLChar(unsigned int columnIndex) const;
SQLCHAR getSQLChar(std::string tableName, std::string columnName) const;
std::string getSQLVarchar(unsigned int columnIndex) const;
std::string getSQLVarchar(std::string tableName, std::string columnName) const;
SQLWCHAR getSQLWChar(unsigned int columnIndex) const;
SQLWCHAR getSQLWChar(std::string tableName, std::string columnName) const;
std::wstring getSQLWVarchar(unsigned int columnIndex) const;
std::wstring getSQLWVarchar(std::string tableName, std::string columnName) const;
SQLREAL getSQLReal(unsigned int columnIndex) const;
SQLREAL getSQLReal(std::string tableName, std::string columnName) const;
SQLFLOAT getSQLFloat(unsigned int columnIndex) const;
SQLFLOAT getSQLFloat(std::string tableName, std::string columnName) const;
SQLDOUBLE getSQLDouble(unsigned int columnIndex) const;
SQLDOUBLE getSQLDouble(std::string tableName, std::string columnName) const;
std::string getSQLDecimal(unsigned int columnIndex) const;
std::string getSQLDecimal(std::string tableName, std::string columnName) const;
SQLINTEGER getSQLInteger(unsigned int columnIndex) const;
SQLINTEGER getSQLInteger(std::string tableName, std::string columnName) const;
SQLSMALLINT getSQLSmallInt(unsigned int columnIndex) const;
SQLSMALLINT getSQLSmallInt(std::string tableName, std::string columnName) const;
bool isNull(unsigned int columnIndex) const;
bool isNull(std::string tableName, std::string columnName) const;
unsigned int getRowCount(void) const;
bool next(void);
};
};
};
};
#endif //RESULT_SET_H
|