16#if !defined(PQXX_HEADER_PRE)
17# error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
20#include "pqxx/except.hxx"
21#include "pqxx/field.hxx"
22#include "pqxx/result.hxx"
24#include "pqxx/internal/concat.hxx"
71 return not operator==(
rhs);
75 [[nodiscard]] const_iterator begin() const noexcept;
76 [[nodiscard]] const_iterator cbegin() const noexcept;
77 [[nodiscard]] const_iterator end() const noexcept;
78 [[nodiscard]] const_iterator cend() const noexcept;
84 [[nodiscard]] reference front() const noexcept;
85 [[nodiscard]] reference back() const noexcept;
96 [[nodiscard]] reference operator[](size_type) const noexcept;
100 [[nodiscard]] reference operator[](
zview col_name) const;
102 reference at(size_type) const;
106 reference at(
zview col_name) const;
110 return m_end - m_begin;
113 [[deprecated(
"Swap iterators, not rows.")]]
void swap(
row &)
noexcept;
126 [[nodiscard]] size_type column_number(
zview col_name)
const;
129 [[nodiscard]] oid column_type(size_type)
const;
134 return column_type(column_number(
col_name));
138 [[nodiscard]] oid column_table(size_type col_num)
const;
143 return column_table(column_number(
col_name));
154 [[nodiscard]] size_type table_column(size_type)
const;
159 return table_column(column_number(
col_name));
179 [[deprecated(
"Row slicing is going away. File a bug if you need it.")]]
row
180 slice(size_type sbegin, size_type send)
const;
183 [[nodiscard, deprecated(
"Row slicing is going away.")]] PQXX_PURE
bool
184 empty() const noexcept;
194 check_size(std::tuple_size_v<Tuple>);
206 check_size(
sizeof...(
TYPE));
207 using seq = std::make_index_sequence<
sizeof...(TYPE)>;
208 return get_tuple<std::tuple<
TYPE...>>(
seq{});
221 "Tried to extract ",
expected,
" field(s) from a row of ", size(),
231 using seq = std::make_index_sequence<std::tuple_size_v<TUPLE>>;
239 extract_fields(
t, std::make_index_sequence<std::tuple_size_v<Tuple>>{});
262 void extract_fields(
Tuple &
t, std::index_sequence<indexes...>)
const
267 template<
typename Tuple, std::
size_t index>
268 void extract_value(Tuple &t)
const;
271 template<
typename TUPLE, std::size_t... indexes>
272 auto get_tuple(std::index_sequence<indexes...>)
const
274 return std::make_tuple(get_field<TUPLE, indexes>()...);
278 template<
typename TUPLE, std::
size_t index>
auto get_field()
const
280 return (*
this)[index].as<std::tuple_element_t<index, TUPLE>>();
296#include "pqxx/internal/ignore-deprecated-pre.hxx"
298#include "pqxx/internal/ignore-deprecated-post.hxx"
300 field{t.m_result, t.m_index, c}
310 [[nodiscard]] constexpr
pointer operator->() const noexcept
358 [[nodiscard]]
constexpr bool
361 return col() == i.col();
363 [[nodiscard]]
constexpr bool
366 return col() != i.col();
368 [[nodiscard]]
constexpr bool
371 return col() < i.col();
373 [[nodiscard]]
constexpr bool
376 return col() <= i.col();
378 [[nodiscard]]
constexpr bool
381 return col() > i.col();
383 [[nodiscard]]
constexpr bool
386 return col() >= i.col();
395 operator+(difference_type)
const noexcept;
431 [[nodiscard]] PQXX_PURE iterator_type base() const noexcept;
437 using iterator_type::operator->;
438 using iterator_type::operator*;
445 const_reverse_row_iterator &
448 iterator_type::operator=(r);
453 iterator_type::operator--();
460 iterator_type::operator++();
467 iterator_type::operator-=(i);
472 iterator_type::operator+=(i);
491 [[nodiscard]] difference_type
494 return rhs.const_row_iterator::operator-(*this);
505 return iterator_type::operator==(rhs);
510 return !operator==(rhs);
513 [[nodiscard]]
constexpr bool
516 return iterator_type::operator>(rhs);
518 [[nodiscard]]
constexpr bool
521 return iterator_type::operator>=(rhs);
523 [[nodiscard]]
constexpr bool
526 return iterator_type::operator<(rhs);
528 [[nodiscard]]
constexpr bool
531 return iterator_type::operator<=(rhs);
542 row{home(), idx(), home().columns()},
557 row{home(), idx(), home().columns()},
568template<
typename Tuple, std::
size_t index>
569inline void row::extract_value(Tuple &t)
const
The home of all libpqxx classes, functions, templates, etc.
Definition array.hxx:27
int result_size_type
Number of rows in a result set.
Definition types.hxx:28
const_row_iterator operator+(const_row_iterator::difference_type o, const_row_iterator const &i) noexcept
Definition row.hxx:546
int row_size_type
Number of fields in a row of database data.
Definition types.hxx:34
int row_difference_type
Difference between row sizes.
Definition types.hxx:37
Internal items for libpqxx' own use. Do not use these yourself.
Definition composite.hxx:83
Error in usage of libpqxx library, similar to std::logic_error.
Definition except.hxx:174
Reference to a field in a result set.
Definition field.hxx:35
Result set containing data returned by a query or command.
Definition result.hxx:74
result_size_type size_type
Definition result.hxx:76
Reference to one row in a result.
Definition row.hxx:47
std::tuple< TYPE... > as() const
Extract entire row's values into a tuple.
Definition row.hxx:204
row_size_type size_type
Definition row.hxx:49
oid column_type(zview col_name) const
Return a column's type.
Definition row.hxx:132
row_difference_type difference_type
Definition row.hxx:50
result m_result
Result set of which this is one row.
Definition row.hxx:245
result::size_type m_index
Row number.
Definition row.hxx:252
const_reverse_iterator reverse_iterator
Definition row.hxx:56
constexpr result::size_type num() const noexcept
Definition row.hxx:163
constexpr result::size_type rownumber() const noexcept
Row number, assuming this is a real row and not end()/rend().
Definition row.hxx:116
TUPLE as_tuple() const
Convert to a given tuple of values, don't check sizes.
Definition row.hxx:229
void check_size(size_type expected) const
Throw usage_error if row size is not expected.
Definition row.hxx:217
size_type table_column(zview col_name) const
What column number in its table did this result column come from?
Definition row.hxx:157
void convert(Tuple &t) const
Convert entire row to tuple fields, without checking row size.
Definition row.hxx:237
oid column_table(zview col_name) const
What table did this column come from?
Definition row.hxx:141
Iterator for fields in a row. Use as row::const_iterator.
Definition row.hxx:287
const_row_iterator operator-(difference_type) const noexcept
Definition row.hxx:553
const_row_iterator & operator=(const_row_iterator &&) noexcept=default
reference operator*() const noexcept
Definition row.hxx:314
const_row_iterator(field const &F) noexcept
Definition row.hxx:302
friend const_row_iterator operator+(difference_type, const_row_iterator const &) noexcept
Definition row.hxx:546
constexpr bool operator>=(const_row_iterator const &i) const noexcept
Definition row.hxx:384
const_row_iterator(const_row_iterator const &) noexcept=default
const_row_iterator & operator=(const_row_iterator const &) noexcept=default
std::random_access_iterator_tag iterator_category
Definition row.hxx:289
constexpr bool operator==(const_row_iterator const &i) const noexcept
Definition row.hxx:359
field const * pointer
Definition row.hxx:291
field const value_type
Definition row.hxx:290
const_row_iterator()=default
constexpr bool operator!=(const_row_iterator const &i) const noexcept
Definition row.hxx:364
const_row_iterator(const_row_iterator &&) noexcept=default
row_size_type size_type
Definition row.hxx:292
const_row_iterator & operator--() noexcept
Definition row.hxx:336
row_difference_type difference_type
Definition row.hxx:293
const_row_iterator & operator-=(difference_type i) noexcept
Definition row.hxx:347
const_row_iterator & operator+=(difference_type i) noexcept
Definition row.hxx:342
const_row_iterator(row const &t, row_size_type c) noexcept
Definition row.hxx:299
constexpr bool operator>(const_row_iterator const &i) const noexcept
Definition row.hxx:379
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition row.hxx:410
const_reverse_row_iterator operator++() noexcept
Definition row.hxx:451
bool operator!=(const_reverse_row_iterator const &rhs) const noexcept
Definition row.hxx:508
constexpr bool operator>=(const_reverse_row_iterator const &rhs) const noexcept
Definition row.hxx:529
constexpr bool operator>(const_reverse_row_iterator const &rhs) const noexcept
Definition row.hxx:524
difference_type operator-(const_reverse_row_iterator const &rhs) const noexcept
Definition row.hxx:492
const_reverse_row_iterator & operator+=(difference_type i) noexcept
Definition row.hxx:465
const_reverse_row_iterator operator+(difference_type i) const noexcept
Definition row.hxx:482
const_reverse_row_iterator & operator-=(difference_type i) noexcept
Definition row.hxx:470
const_reverse_row_iterator & operator--() noexcept
Definition row.hxx:458
row_difference_type difference_type
Definition row.hxx:293
bool operator==(const_reverse_row_iterator const &rhs) const noexcept
Definition row.hxx:503
const_reverse_row_iterator() noexcept=default
const_reverse_row_iterator operator-(difference_type i) noexcept
Definition row.hxx:487
iterator_type::value_type value_type
Definition row.hxx:417
Marker-type wrapper: zero-terminated std::string_view.
Definition zview.hxx:38