Kea 2.7.5
|
Convenience class which facilitates fetching column values from a result set row. More...
#include <pgsql_exchange.h>
Public Member Functions | |
PgSqlResultRowWorker (const PgSqlResult &r, const int row) | |
Constructor. | |
std::string | dumpRow () |
Diagnostic tool which dumps the Result row contents as a string. | |
uint64_t | getBigInt (const size_t col) |
Fetches the uint64_t value at the given column. | |
bool | getBool (const size_t col) |
Fetches the boolean value at the given column. | |
void | getBytes (const size_t col, std::vector< uint8_t > &value) |
Fetches binary data at the given column into a vector. | |
template<typename T > | |
void | getColumnValue (const size_t col, T &value) |
Fetches a text column as the given value type. | |
double | getDouble (const size_t col) |
Fetches the floating point value at the given column. | |
isc::asiolink::IOAddress | getInet4 (const size_t col) |
Fetches the v4 IP address at the given column. | |
isc::asiolink::IOAddress | getInet6 (const size_t col) |
Fetches the v6 IP address at the given column. | |
uint32_t | getInt (const size_t col) |
Fetches the uint32_t value at the given column. | |
data::ElementPtr | getJSON (const size_t col) |
Fetches a JSON column as an ElementPtr. | |
const char * | getRawColumnValue (const size_t col) |
Gets a pointer to the raw column value in a result set row. | |
uint16_t | getSmallInt (const size_t col) |
Fetches the uint16_t value at the given column. | |
std::string | getString (const size_t col) |
Fetches the column value as a string. | |
boost::posix_time::ptime | getTimestamp (const size_t col) |
Fetches a timestamp column as a ptime. | |
isc::util::Triplet< uint32_t > | getTriplet (const size_t col) |
Fetches a uint32_t value into a Triplet using a single column value. | |
isc::util::Triplet< uint32_t > | getTriplet (const size_t def_col, const size_t min_col, const size_t max_col) |
Fetches a uint32_t value into a Triplet using a three column values: default, minimum, and maximum. | |
bool | isColumnNull (const size_t col) |
Indicates whether or not the given column value is null. | |
Convenience class which facilitates fetching column values from a result set row.
Definition at line 844 of file pgsql_exchange.h.
isc::db::PgSqlResultRowWorker::PgSqlResultRowWorker | ( | const PgSqlResult & | r, |
const int | row ) |
Constructor.
r | result set containing the fetched rows of data. |
row | zero-based index of the desired row, (e.g. 0 .. n - 1 where n = number of rows in r) |
DbOperationError | if row value is invalid. |
Definition at line 663 of file pgsql_exchange.cc.
std::string isc::db::PgSqlResultRowWorker::dumpRow | ( | ) |
Diagnostic tool which dumps the Result row contents as a string.
Definition at line 762 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::dumpRow().
uint64_t isc::db::PgSqlResultRowWorker::getBigInt | ( | const size_t | col | ) |
Fetches the uint64_t value at the given column.
col | the column number within the row |
Definition at line 701 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getColumnValue().
bool isc::db::PgSqlResultRowWorker::getBool | ( | const size_t | col | ) |
Fetches the boolean value at the given column.
col | the column number within the row |
Definition at line 682 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getColumnValue().
void isc::db::PgSqlResultRowWorker::getBytes | ( | const size_t | col, |
std::vector< uint8_t > & | value ) |
Fetches binary data at the given column into a vector.
col | the column number within the row | |
[out] | value | vector to receive the fetched data. |
Definition at line 722 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::convertFromBytea().
|
inline |
Fetches a text column as the given value type.
Uses boost::lexicalcast to convert the text column value into a value of type T.
col | the column number within the row | |
[out] | value | parameter to receive the converted value |
Definition at line 946 of file pgsql_exchange.h.
References isc::db::PgSqlExchange::getColumnValue().
Referenced by getJSON(), and getTimestamp().
double isc::db::PgSqlResultRowWorker::getDouble | ( | const size_t | col | ) |
Fetches the floating point value at the given column.
col | the column number within the row |
Definition at line 689 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getColumnValue().
isc::asiolink::IOAddress isc::db::PgSqlResultRowWorker::getInet4 | ( | const size_t | col | ) |
Fetches the v4 IP address at the given column.
This is used to fetch values from inet type columns.
col | the column number within the row |
Definition at line 727 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getInetValue4().
isc::asiolink::IOAddress isc::db::PgSqlResultRowWorker::getInet6 | ( | const size_t | col | ) |
Fetches the v6 IP address at the given column.
This is used to fetch values from inet type columns.
col | the column number within the row |
Definition at line 732 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getInetValue6().
uint32_t isc::db::PgSqlResultRowWorker::getInt | ( | const size_t | col | ) |
Fetches the uint32_t value at the given column.
col | the column number within the row |
Definition at line 708 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getColumnValue().
data::ElementPtr isc::db::PgSqlResultRowWorker::getJSON | ( | const size_t | col | ) |
Fetches a JSON column as an ElementPtr.
col | the column number within the row |
Definition at line 744 of file pgsql_exchange.cc.
References getColumnValue().
const char * isc::db::PgSqlResultRowWorker::getRawColumnValue | ( | const size_t | col | ) |
Gets a pointer to the raw column value in a result set row.
Given a column return a const char* pointer to the data value in the result set row. The pointer is valid as long as the underlying result set has not been freed. It may point to text or binary data depending on how query was structured. You should not attempt to free this pointer.
col | the column number within the row |
Definition at line 696 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getRawColumnValue().
uint16_t isc::db::PgSqlResultRowWorker::getSmallInt | ( | const size_t | col | ) |
Fetches the uint16_t value at the given column.
col | the column number within the row |
Definition at line 715 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getColumnValue().
std::string isc::db::PgSqlResultRowWorker::getString | ( | const size_t | col | ) |
Fetches the column value as a string.
col | the column number within the row |
Definition at line 675 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getColumnValue().
boost::posix_time::ptime isc::db::PgSqlResultRowWorker::getTimestamp | ( | const size_t | col | ) |
Fetches a timestamp column as a ptime.
col | the column number within the row |
Definition at line 737 of file pgsql_exchange.cc.
References getColumnValue().
isc::util::Triplet< uint32_t > isc::db::PgSqlResultRowWorker::getTriplet | ( | const size_t | col | ) |
Fetches a uint32_t value into a Triplet using a single column value.
col | the column number within the row If the column is null, the Triplet is returned as unspecified. |
Definition at line 751 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getTripletValue().
isc::util::Triplet< uint32_t > isc::db::PgSqlResultRowWorker::getTriplet | ( | const size_t | def_col, |
const size_t | min_col, | ||
const size_t | max_col ) |
Fetches a uint32_t value into a Triplet using a three column values: default, minimum, and maximum.
def_col | the column number within the row that contains the default value. If this column is null, the Triplet is returned as unspecified. |
min_col | the column number within the row that contains the minimum value. |
max_col | the column number within the row that contains the maximum value. |
Definition at line 756 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::getTripletValue().
bool isc::db::PgSqlResultRowWorker::isColumnNull | ( | const size_t | col | ) |
Indicates whether or not the given column value is null.
col | the column number within the row |
Definition at line 670 of file pgsql_exchange.cc.
References isc::db::PgSqlExchange::isColumnNull().