|
libpqxx
The C++ client library for PostgreSQL
|
Reference to one row in a result. More...
#include <row.hxx>
Public Types | |
| using | size_type = row_size_type |
| using | difference_type = row_difference_type |
| using | reference = field_ref |
| using | pointer = const_row_iterator |
| using | const_iterator = const_row_iterator |
| using | iterator = const_iterator |
| using | const_reverse_iterator = const_reverse_row_iterator |
| using | reverse_iterator = const_reverse_iterator |
Public Member Functions | |
| row () noexcept=default | |
| row (row &&) noexcept=default | |
| row (row const &) noexcept=default | |
| row (row_ref const &ref) | |
| ~row ()=default | |
| row & | operator= (row const &) noexcept=default |
| row & | operator= (row &&) noexcept=default |
Comparison | |
Equality between two row objects means that they refer to the same row in the same data structure that we originally received from the database. So the two may have been created from different result objects, so long as those are both copies of (or the same as) the same original result that you received from the database. | |
| PQXX_PURE bool | operator== (row const &rhs) const noexcept |
| PQXX_PURE bool | operator!= (row const &rhs) const noexcept |
Iteration | |
A row acts like a container of fields. | |
| PQXX_PURE const_iterator | begin () const noexcept |
| PQXX_PURE const_iterator | cbegin () const noexcept |
| PQXX_PURE const_iterator | end () const noexcept |
| PQXX_PURE const_iterator | cend () const noexcept |
| PQXX_PURE const_reverse_row_iterator | rbegin () const noexcept |
| PQXX_PURE const_reverse_row_iterator | crbegin () const noexcept |
| PQXX_PURE const_reverse_row_iterator | rend () const noexcept |
| PQXX_PURE const_reverse_row_iterator | crend () const noexcept |
Field access | |
| field_ref | front () const noexcept |
| field_ref | back () const noexcept |
| PQXX_PURE field_ref | operator[] (size_type) const noexcept |
| PQXX_PURE field_ref | operator[] (zview col_name) const |
| field_ref | at (size_type, sl=sl::current()) const |
| Address a field by number, but check that the number is in range. More... | |
| field_ref | at (zview col_name, sl=sl::current()) const |
| constexpr PQXX_PURE size_type | size () const noexcept |
| constexpr result::size_type | rownumber () const noexcept |
| Row number, assuming this is a real row and not end()/rend(). More... | |
| constexpr PQXX_PURE result::size_type | row_number () const noexcept |
| Row number, assuming this is a real row and not end()/rend(). More... | |
Column information | |
| class | field |
| size_type | column_number (zview col_name, sl loc=sl::current()) const |
| Number of given column (throws exception if it doesn't exist). More... | |
| oid | column_type (size_type col_num, sl loc=sl::current()) const |
| Return a column's type. More... | |
| oid | column_type (zview col_name, sl loc=sl::current()) const |
| Return a column's type. More... | |
| oid | column_table (size_type col_num, sl loc=sl::current()) const |
| What table did this column come from? More... | |
| oid | column_table (zview col_name, sl loc=sl::current()) const |
| What table did this column come from? More... | |
| size_type | table_column (size_type col, sl loc=sl::current()) const |
| What column number in its table did this result column come from? More... | |
| size_type | table_column (zview col_name, sl loc=sl::current()) const |
| What column number in its table did this result column come from? More... | |
| constexpr PQXX_PURE result::size_type | num () const noexcept |
| template<typename Tuple > | |
| void | to (Tuple &t, sl loc=sl::current()) const |
| Extract entire row's values into a tuple. More... | |
| template<typename... TYPE> | |
| std::tuple< TYPE... > | as (sl loc=sl::current()) const |
| Extract entire row's values into a tuple. More... | |
| template<typename TUPLE > | |
| TUPLE | as_tuple (sl loc=sl::current()) const requires(requires(TUPLE t) |
| Convert to a given tuple of values,. More... | |
| void | swap (row &) noexcept |
Reference to one row in a result.
A row is a reference to one particular row of data in a query result set (represented by a result object).
This is like a row_ref, except (as far as this class is concerned) it is safe to destroy the result object or move it to a different place in memory. That's because unlike row_ref, a row contains its own copy of the internal smart pointer referring to the actual data in memory. You do pay a performance price for this, so prefer row_ref where possible.
A row also acts as a container, mapping column numbers or names to field values:
| using pqxx::row::iterator = const_iterator |
| using pqxx::row::pointer = const_row_iterator |
| using pqxx::row::reference = field_ref |
| using pqxx::row::size_type = row_size_type |
|
defaultnoexcept |
|
defaultnoexcept |
|
defaultnoexcept |
|
inlineexplicit |
|
default |
|
inline |
Extract entire row's values into a tuple.
Converts to the types of the tuple's respective fields.
The types must have conversions from PostgreSQL's text format defined; see Supporting additional data types.
| usage_error | If the number of columns in the row does not match the number of fields in t. |
|
inline |
Convert to a given tuple of values,.
Useful in cases where we have a full tuple of field types, but not a parameter pack.
TUPLE should be a tuple type, with the same number of elements as the result has columns.
| usage_error | If the number of columns in the row does not match the number of fields in TUPLE. |
| pqxx::field_ref pqxx::row::at | ( | size_type | i, |
| sl | loc = sl::current() |
||
| ) | const |
Address a field by number, but check that the number is in range.
| pqxx::field_ref pqxx::row::at | ( | zview | col_name, |
| sl | loc = sl::current() |
||
| ) | const |
Address field by name.
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Number of given column (throws exception if it doesn't exist).
What table did this column come from?
What table did this column come from?
Return a column's type.
Return a column's type.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
|
inlineconstexprnoexcept |
|
noexcept |
Address field by name.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
Row number, assuming this is a real row and not end()/rend().
|
inlineconstexprnoexcept |
Row number, assuming this is a real row and not end()/rend().
|
noexcept |
What column number in its table did this result column come from?
A meaningful answer can be given only if the column in question comes directly from a column in a table. If the column is computed in any other way, a logic_error will be thrown.
| col_num | a zero-based column number in this result set |
What column number in its table did this result column come from?
|
inline |
Extract entire row's values into a tuple.
Converts to the types of the tuple's respective fields.
The types in the tuple must have conversions from PostgreSQL's text format defined; see Supporting additional data types.
| usage_error | If the number of columns in the row does not match the number of fields in t. |
|
friend |