Data row in a result set This class is a mere accessor to underlying result set data buffer, must not be used outside of result set life scope.
Mimics field container
Definition at line 46 of file row.hpp.
|
class | ResultSet |
|
template<typename T , typename Tag > |
class | TypedResultSet |
|
template<typename T > |
void | To (T &&val) const |
|
template<typename T > |
void | To (T &&val, RowTag) const |
|
template<typename T > |
void | To (T &&val, FieldTag) const |
|
template<typename... T> |
void | To (T &&... val) const |
| Read fields into variables in order of their appearance in the row.
|
|
template<typename T , typename... Y> |
auto | As () const |
| Parse values from the row and return the result.
|
|
template<typename T > |
T | As (RowTag) const |
| Returns T initialized with values of the row.
|
|
template<typename T > |
T | As (FieldTag) const |
| Returns T initialized with a single column value of the row.
|
|
template<typename... T> |
void | To (const std::initializer_list<::utils::zstring_view > &names, T &&... val) const |
| Read fields into variables in order of their names in the first argument.
|
|
template<typename... T> |
std::tuple< T... > | As (const std::initializer_list<::utils::zstring_view > &names) const |
|
template<typename... T> |
void | To (const std::initializer_list< size_type > &indexes, T &&... val) const |
|
template<typename... T> |
std::tuple< T... > | As (const std::initializer_list< size_type > &indexes) const |
|
size_type | IndexOfName (::utils::zstring_view) const |
|
FieldView | GetFieldView (size_type index) const |
|
| Row (detail::ResultWrapperPtr res, size_type row) |
|
template<typename T , typename... Y>
auto storages::postgres::Row::As |
( |
| ) |
const |
Parse values from the row and return the result.
If there are more than one type arguments to the function, it will return a tuple of those types.
If there is a single type argument to the function, it will read the first and the only column of the row or the whole row to the row type (depending on C++ to PosgreSQL mapping presence) and return plain value of this type.
- See also
- To(T&&)
Definition at line 383 of file row.hpp.
template<typename T >
void storages::postgres::Row::To |
( |
T && |
val | ) |
const |
Read the contents of the row to a user's row type or read the first column into the value.
If the user tries to read the first column into a variable, it must be the only column in the result set. If the result set contains more than one column, the function will throw NonSingleColumnResultSet. If the result set is OK to contain more than one columns, the first column value should be accessed via row[0].To/As
.
If the type is a 'row' type, the function will read the fields of the row into the type's data members.
If the type can be treated as both a row type and a composite type (the type is mapped to a PostgreSQL type), the function will treat the type as a type for the first (and the only) column.
To read the all fields of the row as a row type, the To(T&&, RowTag) should be used.
Definition at line 334 of file row.hpp.