9 #ifndef PQXX_INTERNAL_RESULT_ITER_HXX
10 #define PQXX_INTERNAL_RESULT_ITER_HXX
45 m_home{&home}, m_size{std::size(home)}
47 if (not std::empty(home))
56 sl const loc{sl::current()};
58 if (m_index >= m_size)
60 else if (m_home !=
nullptr) [[likely]]
68 return m_home == rhs.m_home;
72 return not(*
this == rhs);
78 void read(
sl loc) { (*m_home)[m_index].convert(m_value, loc); }
80 result const *m_home{
nullptr};
100 if (std::empty(m_home))
124 template<
typename CALLABLE>
128 constexpr
auto sz{std::tuple_size_v<args_tuple>};
131 "Callback for for_each must take parameters, one for each column in the "
134 auto const cols{this->columns()};
138 "Callback to for_each takes {} parameter(s), but result set has {} "
144 for (
auto const r : *
this)
Definition: row_ref-result.hxx:15
Iterator for looped unpacking of a result.
Definition: result_iter.hxx:31
result_iter()=default
Construct an "end" iterator.
value_type const & operator*() const noexcept
Definition: result_iter.hxx:75
result_iter & operator=(result_iter &&)=delete
bool operator==(result_iter const &rhs) const noexcept
Comparison only works for comparing to end().
Definition: result_iter.hxx:66
result_iter(result_iter &&)=delete
result_iter(result_iter const &)=delete
result_iter(result const &home, sl loc=sl::current())
Definition: result_iter.hxx:44
result_iter & operator=(result_iter const &)=delete
std::tuple< TYPE... > value_type
Definition: result_iter.hxx:33
result_iter & operator++()
Definition: result_iter.hxx:51
bool operator!=(result_iter const &rhs) const noexcept
Definition: result_iter.hxx:70
Iterator for implementing pqxx::result::iter().
Definition: result_iter.hxx:89
iterator end() const
Definition: result_iter.hxx:105
iterator begin() const
Definition: result_iter.hxx:98
result_iteration(result home)
Definition: result_iter.hxx:93
Result set containing data returned by a query or command.
Definition: result.hxx:101
void for_each(CALLABLE &&func, sl=sl::current()) const
Run func on each row, passing the row's fields as parameters.
Definition: result_iter.hxx:125
result_size_type size_type
Definition: result.hxx:103
result const & expect_columns(row_size_type cols, sl loc=sl::current()) const
Expect that result consists of exactly cols columns.
Definition: result.hxx:476
auto iter() const
Iterate rows, reading them directly into a tuple of "TYPE...".
Definition: result_iter.hxx:114
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:580
Private namespace for libpqxx's internal use; do not access.
Definition: connection.cxx:333
decltype(strip_types(std::declval< TYPES... >())) strip_types_t
Take a tuple type and apply std::remove_cvref_t to its component types.
Definition: util.hxx:612
decltype(args_f(std::declval< CALLABLE >())) args_t
A callable's parameter types, as a tuple.
Definition: util.hxx:598
The home of all libpqxx classes, functions, templates, etc.
Definition: array.cxx:26
std::source_location sl
Convenience alias for std::source_location. It's just too long.
Definition: types.hxx:38
format
Format code: is data text or binary?
Definition: types.hxx:121