|
libpqxx
The C++ client library for PostgreSQL
|
Lightweight 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 | const_iterator = const_row_iterator |
| using | iterator = const_iterator |
| using | reference = field_ref |
| using | pointer = field_ref const * |
| using | const_reverse_iterator = const_reverse_row_iterator |
| using | reverse_iterator = const_reverse_iterator |
Public Member Functions | |
| row_ref ()=default | |
| row_ref (row_ref const &)=default | |
| row_ref (row_ref &&)=default | |
| row_ref (result const &res, result_size_type index) | |
| ~row_ref ()=default | |
| row_ref & | operator= (row_ref const &) noexcept=default |
| row_ref & | operator= (row_ref &&) noexcept=default |
Comparison | |
Equality between two row_ref objects means that they both refer to the same row in _the exact same result object._ So, if you copy a result, even though the two copies refer to the exact same underlying data structure, a {
pqxx::result const r2{r1};
if (not r1.empty())
{
assert(r1[0] == r1[0]);
assert(r2[0] != r1[0]);
}
}
| |
| PQXX_PURE bool | operator== (row_ref const &rhs) const noexcept |
| PQXX_PURE bool | operator!= (row_ref const &rhs) const noexcept |
| const_iterator | cbegin () const noexcept |
| const_iterator | begin () const noexcept |
| const_iterator | end () const noexcept |
| const_iterator | cend () const noexcept |
Field access | |
| reference | front () const noexcept |
| reference | back () const noexcept |
| const_reverse_row_iterator | crbegin () const noexcept |
| const_reverse_row_iterator | rbegin () const noexcept |
| const_reverse_row_iterator | crend () const noexcept |
| const_reverse_row_iterator | rend () const noexcept |
| PQXX_PURE reference | operator[] (size_type i) const noexcept |
| PQXX_PURE reference | operator[] (zview col_name) const |
| reference | at (size_type i, sl loc=sl::current()) const |
| Address a field by number, but check that the number is in range. More... | |
| reference | at (zview col_name, sl loc=sl::current()) const |
| Address field by name. More... | |
| PQXX_PURE size_type | size () const noexcept |
| 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 | |
| using | seq = std::make_index_sequence< std::tuple_size_v< TUPLE > > |
| class | pqxx::internal::gate::row_ref_const_result_iterator |
| class | pqxx::internal::gate::row_ref_result |
| template<typename... T> | |
| class | pqxx::internal::result_iter |
| class | pqxx::internal::gate::row_ref_row |
| size_type | column_number (zview col_name, sl=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=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_num, 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... | |
| 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... | |
| return | get_tuple (seq{}, loc) |
| PQXX_PURE result const & | home () const noexcept |
The result object to which this row_ref refers. More... | |
Lightweight reference to one row in a result.
Like row, represents one row in a query result set. Unlike with row, however, for as long as you're using a row_ref, the result object to which it refers must...
When you use row_ref, it is your responsibility to ensure all that.
A row_ref is one way of accessing the fields themselves.
| using pqxx::row_ref::pointer = field_ref const * |
| using pqxx::row_ref::reference = field_ref |
| using pqxx::row_ref::seq = std::make_index_sequence<std::tuple_size_v<TUPLE> > |
|
default |
|
default |
|
default |
|
inline |
|
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. |
Address a field by number, but check that the number is in range.
Address field by name.
This function could perhaps be marked as "pure," but in clang and some gcc configurations this may move exceptions out of try blocks that are meant to catch them.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Number of given column (throws exception if it doesn't exist).
This function could perhaps be marked as "pure," but in clang and some gcc configurations this may move exceptions out of try blocks that are meant to catch them.
What table did this column come from?
This function could perhaps be marked as "pure," but in clang and some gcc configurations this may move exceptions out of try blocks that are meant to catch them.
What table did this column come from?
This function could perhaps be marked as "pure," but in clang and some gcc configurations this may move exceptions out of try blocks that are meant to catch them.
Return a column's type.
This function could perhaps be marked as "pure," but in clang and some gcc configurations this may move exceptions out of try blocks that are meant to catch them.
Return a column's type.
This function could perhaps be marked as "pure," but in clang and some gcc configurations this may move exceptions out of try blocks that are meant to catch them.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
| return pqxx::row_ref::get_tuple | ( | seq{} | , |
| loc | |||
| ) |
| pqxx::field_ref pqxx::row_ref::operator[] | ( | zview | col_name | ) | const |
Address field by name.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
Row number, assuming this is a real row and not end()/rend().
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 |
|
friend |
|
friend |
|
friend |