19 #ifndef RESULT_SET_HPP 20 #define RESULT_SET_HPP 22 #include "utilities.hpp" 24 namespace vgi {
namespace dbconn {
namespace dbi {
36 virtual bool has_data() = 0;
37 virtual bool more_results() = 0;
38 virtual size_t row_count()
const = 0;
39 virtual size_t rows_affected()
const = 0;
40 virtual size_t column_count()
const = 0;
41 virtual bool next() = 0;
42 virtual bool prev() = 0;
43 virtual bool first() = 0;
44 virtual bool last() = 0;
45 virtual std::string column_name(
size_t col_idx) = 0;
46 virtual int column_index(
const std::string& col_name) = 0;
47 virtual bool is_null(
size_t col_idx) = 0;
48 virtual int16_t get_short(
size_t col_idx) = 0;
49 virtual uint16_t get_ushort(
size_t col_idx) = 0;
50 virtual int32_t get_int(
size_t col_idx) = 0;
51 virtual uint32_t get_uint(
size_t col_idx) = 0;
52 virtual int64_t get_long(
size_t col_idx) = 0;
53 virtual uint64_t get_ulong(
size_t col_idx) = 0;
54 virtual float get_float(
size_t col_idx) = 0;
55 virtual double get_double(
size_t col_idx) = 0;
56 virtual bool get_bool(
size_t col_idx) = 0;
57 virtual char get_char(
size_t col_idx) = 0;
58 virtual std::string get_string(
size_t col_idx) = 0;
59 virtual int get_date(
size_t col_idx) = 0;
60 virtual double get_time(
size_t col_idx) = 0;
61 virtual time_t get_datetime(
size_t col_idx) = 0;
62 virtual char16_t get_u16char(
size_t col_idx) = 0;
63 virtual std::u16string get_u16string(
size_t col_idx) = 0;
64 virtual std::vector<uint8_t> get_binary(
size_t col_idx) = 0;
105 rs_impl = rs.rs_impl;
117 rs_impl = std::move(rs.rs_impl);
130 return rs_impl->has_data();
139 return rs_impl->more_results();
148 return rs_impl->row_count();
157 return rs_impl->rows_affected();
166 return rs_impl->column_count();
177 return std::move(rs_impl->column_name(col_idx));
188 return rs_impl->column_index(col_name);
197 return rs_impl->next();
207 return rs_impl->prev();
217 return rs_impl->first();
227 return rs_impl->last();
238 return rs_impl->is_null(col_idx);
249 return rs_impl->is_null(rs_impl->column_index(colname));
252 #define get_type_by_index(t) get_##t(size_t col_idx) { return rs_impl->get_##t(col_idx); } 253 #define get_type_by_name(t) get_##t(const std::string& colname) { return rs_impl->get_##t(rs_impl->column_index(colname)); } 255 int16_t get_type_by_index(
short);
256 int16_t get_type_by_name(
short);
257 uint16_t get_type_by_index(ushort);
258 uint16_t get_type_by_name(ushort);
259 int32_t get_type_by_index(
int);
260 int32_t get_type_by_name(
int);
261 uint32_t get_type_by_index(uint);
262 uint32_t get_type_by_name(uint);
263 int64_t get_type_by_index(
long);
264 int64_t get_type_by_name(
long);
265 uint64_t get_type_by_index(ulong);
266 uint64_t get_type_by_name(ulong);
267 float get_type_by_index(
float);
268 float get_type_by_name(
float);
269 double get_type_by_index(
double);
270 double get_type_by_name(
double);
271 bool get_type_by_index(
bool);
272 bool get_type_by_name(
bool);
273 char get_type_by_index(
char);
274 char get_type_by_name(
char);
275 std::string get_type_by_index(
string);
276 std::string get_type_by_name(
string);
277 int get_type_by_index(date);
278 int get_type_by_name(date);
279 double get_type_by_index(time);
280 double get_type_by_name(time);
281 time_t get_type_by_index(datetime);
282 time_t get_type_by_name(datetime);
283 char16_t get_type_by_index(u16char);
284 char16_t get_type_by_name(u16char);
285 std::u16string get_type_by_index(u16string);
286 std::u16string get_type_by_name(u16string);
287 std::vector<uint8_t> get_type_by_index(binary);
288 std::vector<uint8_t> get_type_by_name(binary);
302 #endif // RESULT_SET_HPP iresult_set - is an interface that describes common functionality for all concrete native implementat...
const std::string column_name(size_t col_idx)
Function returns column name by column index or throws an exception if index is invalid.
statement - is a class that manages native driver statement handle.
bool has_data()
Function checks if current result set contains data.
bool more_results()
Function checks if there is another data set or status.
size_t rows_affected() const
Function returns number of affected rows after execution of command.
result_set(const result_set &rs)
Copy constructor.
bool last()
Function moves iterator to the last row of the current result data set This function can only be used...
bool first()
Function moves iterator to the first row of the current result data set This function can only be use...
size_t column_count() const
Function returns number of columns of current result set or zero.
result_set & operator=(const result_set &rs)
Assignment copy operator.
bool is_null(const std::string &colname)
Function checks if cell data is NULL by column name or throws an exception if index is invalid...
int column_index(const std::string &col_name)
Function returns column index by column name, if column name is invalid then -1 is returned...
bool is_null(size_t col_idx)
Function checks if cell data is NULL by column index or throws an exception if index is invalid...
result_set & operator=(result_set &&rs)
Assignment move operator.
bool prev()
Function moves iterator to the previous row of the current result data set This function can only be ...
size_t row_count() const
Function returns current row count while iterating through the result set and total number of rows af...
result_set - is a class that manages native driver result_set handle.
bool next()
Function moves iterator to the next row of the current result data set.
result_set(result_set &&rs)
Move constructor.