![]() |
AnCH Framework
0.1
Another C++ Hack Framework
|
SQL result representation. More...
#include <resultSet.hpp>
Public Member Functions | |
| ResultSet () | |
| virtual | ~ResultSet () |
| template<typename T > | |
| const T * | get (std::size_t idx) throw (SqlException) |
| template<typename T > | |
| bool | get (std::size_t idx, T &out) throw (SqlException) |
| template<typename T > | |
| bool | get (const std::string field, T &out) throw (SqlException) |
| template<typename T > | |
| const T * | get (const std::string field) throw (SqlException) |
| virtual bool | next ()=0 throw (SqlException) |
| template<> | |
| bool | get (std::size_t idx, int64_t &out) throw (SqlException) |
| template<> | |
| bool | get (std::size_t idx, int32_t &out) throw (SqlException) |
| template<> | |
| bool | get (std::size_t idx, int16_t &out) throw (SqlException) |
| template<> | |
| bool | get (std::size_t idx, uint64_t &out) throw (SqlException) |
| template<> | |
| bool | get (std::size_t idx, uint32_t &out) throw (SqlException) |
| template<> | |
| bool | get (std::size_t idx, uint16_t &out) throw (SqlException) |
| template<> | |
| const int64_t * | get (std::size_t idx) throw (SqlException) |
| template<> | |
| const int32_t * | get (std::size_t idx) throw (SqlException) |
| template<> | |
| const int16_t * | get (std::size_t idx) throw (SqlException) |
| template<> | |
| const uint64_t * | get (std::size_t idx) throw (SqlException) |
| template<> | |
| const uint32_t * | get (std::size_t idx) throw (SqlException) |
| template<> | |
| const uint16_t * | get (std::size_t idx) throw (SqlException) |
Protected Member Functions | |
| virtual bool | getValue (std::size_t idx, std::string &out)=0 throw (SqlException) |
Protected Attributes | |
| std::map< std::string, std::size_t > | _fields |
SQL result representation.
The ResultSet has to be used with while(res.hasNext()) {res.next(); [...]}.
Field getter is templated. Specializations are included in library. If you need other conversions, you can implement them in your own program.
| ResultSet::ResultSet | ( | ) |
ResultSet default constructor
|
virtual |
ResultSet destrcutor
| bool anch::sql::ResultSet::get | ( | std::size_t | idx, |
| int64_t & | out | ||
| ) | |||
| throw | ( | SqlException | |
| ) | |||
Get field int64_t value by index.
The output parameter will be set only if SQL result is not NULL.
| idx | the index |
| out | the result |
true if result is NULL, false otherwise| SqlException | any error |
| const T* anch::sql::ResultSet::get | ( | std::size_t | idx | ) | |
| throw | ( | SqlException | |||
| ) | |||||
Get field value by index.
You have to delete result once treated.
| T | expected type |
| idx | the index |
| SqlException | any error |
| bool anch::sql::ResultSet::get | ( | std::size_t | idx, |
| T & | out | ||
| ) | |||
| throw | ( | SqlException | |
| ) | |||
Get field value by index.
The output parameter will be set only if SQL result is not NULL.
| T | expected type |
| idx | the index |
| out | the result |
true if result is NULL, false otherwise| SqlException | any error |
| bool anch::sql::ResultSet::get | ( | std::size_t | idx, |
| int32_t & | out | ||
| ) | |||
| throw | ( | SqlException | |
| ) | |||
Get field int32_t value by index.
The output parameter will be set only if SQL result is not NULL.
| idx | the index |
| out | the result |
true if result is NULL, false otherwise| SqlException | any error |
|
inline | ||||||||||||||||||||
Get field value by field name.
The output parameter will be set only if SQL result is not NULL.
| T | expected type |
| field | the field name |
| out | the result |
true if result is NULL, false otherwise | bool anch::sql::ResultSet::get | ( | std::size_t | idx, |
| int16_t & | out | ||
| ) | |||
| throw | ( | SqlException | |
| ) | |||
Get field int16_t value by index.
The output parameter will be set only if SQL result is not NULL.
| idx | the index |
| out | the result |
true if result is NULL, false otherwise| SqlException | any error |
|
inline | ||||||||||||||
Get field value by field name.
You have to delete result once treated.
| T | expected type |
| field | the field name |
| SqlException | any error |
| bool anch::sql::ResultSet::get | ( | std::size_t | idx, |
| uint64_t & | out | ||
| ) | |||
| throw | ( | SqlException | |
| ) | |||
Get field uint64_t value by index.
The output parameter will be set only if SQL result is not NULL.
| idx | the index |
| out | the result |
true if result is NULL, false otherwise| SqlException | any error |
| bool anch::sql::ResultSet::get | ( | std::size_t | idx, |
| uint32_t & | out | ||
| ) | |||
| throw | ( | SqlException | |
| ) | |||
Get field uint32_t value by index.
The output parameter will be set only if SQL result is not NULL.
| idx | the index |
| out | the result |
true if result is NULL, false otherwise| SqlException | any error |
| bool anch::sql::ResultSet::get | ( | std::size_t | idx, |
| uint16_t & | out | ||
| ) | |||
| throw | ( | SqlException | |
| ) | |||
Get field uint16_t value by index.
The output parameter will be set only if SQL result is not NULL.
| idx | the index |
| out | the result |
true if result is NULL, false otherwise| SqlException | any error |
| const int64_t* anch::sql::ResultSet::get | ( | std::size_t | idx | ) | |
| throw | ( | SqlException | |||
| ) | |||||
Get field int64_t value by index.
You have to delete result once treated.
| idx | the index |
| SqlException | any error |
| const int32_t* anch::sql::ResultSet::get | ( | std::size_t | idx | ) | |
| throw | ( | SqlException | |||
| ) | |||||
Get field int32_t value by index.
You have to delete result once treated.
| idx | the index |
| SqlException | any error |
| const int16_t* anch::sql::ResultSet::get | ( | std::size_t | idx | ) | |
| throw | ( | SqlException | |||
| ) | |||||
Get field int16_t value by index.
You have to delete result once treated.
| idx | the index |
| SqlException | any error |
| const uint64_t* anch::sql::ResultSet::get | ( | std::size_t | idx | ) | |
| throw | ( | SqlException | |||
| ) | |||||
Get field uint64_t value by index.
You have to delete result once treated.
| idx | the index |
| SqlException | any error |
| const uint32_t* anch::sql::ResultSet::get | ( | std::size_t | idx | ) | |
| throw | ( | SqlException | |||
| ) | |||||
Get field uint32_t value by index.
You have to delete result once treated.
| idx | the index |
| SqlException | any error |
| const uint16_t* anch::sql::ResultSet::get | ( | std::size_t | idx | ) | |
| throw | ( | SqlException | |||
| ) | |||||
Get field uint16_t value by index.
You have to delete result once treated.
| idx | the index |
| SqlException | any error |
|
protectedpure virtual | ||||||||||||||||||||
Retrieve string value from result set according to SQL database engine.
| idx | the field index |
| out | the result |
| SqlException | any error |
Implemented in anch::sql::PostgreSQLResultSet, anch::sql::MySQLResultSet, and anch::sql::SQLite3ResultSet.
|
pure virtual | |||||||||||||
Retrieve next row
true if next row exists, false otherwise| SqlException | any error |
Implemented in anch::sql::PostgreSQLResultSet, anch::sql::MySQLResultSet, and anch::sql::SQLite3ResultSet.
|
protected |
Result set fields
1.8.11