Loading...
Searching...
No Matches
pqxx::const_result_iterator Class Reference

Iterator for rows in a result. Use as result::const_iterator. More...

Inheritance diagram for pqxx::const_result_iterator:
[legend]
Collaboration diagram for pqxx::const_result_iterator:
[legend]

## Public Types

using | iterator_category = std::bidirectional_iterator_tag
using | value_type = row const
using | pointer = row const *
using | reference = row
using | size_type = result_size_type
using | difference_type = result_difference_type
Public Types inherited from pqxx::row
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
using | pointer = const_row_iterator
using | const_reverse_iterator = const_reverse_row_iterator
using | reverse_iterator = const_reverse_iterator

## Public Member Functions

| const_result_iterator () noexcept=default
| Create an iterator, but in an unusable state.
| const_result_iterator (const_result_iterator const &) noexcept=default
| Copy an iterator.
| const_result_iterator (const_result_iterator &&) noexcept=default
| Move an iterator.
| const_result_iterator (row const &t) noexcept
| Begin iterating a row.
Dereferencing operators

An iterator "points to" its own row, which is also itself. This makes it easy to address a pqxx::result as a two-dimensional container, without going through the intermediate step of dereferencing the iterator. It makes the interface similar to C pointer/array semantics.

IIRC Alex Stepanov, the inventor of the STL, once remarked that having this as standard behaviour for pointers would be useful in some algorithms. So even if this makes me look foolish, I would seem to be in distinguished company.

pointer | operator-> () const
| Dereference the iterator.
reference | operator* () const
| Dereference the iterator.
Manipulations
const_result_iterator & | operator= (const_result_iterator const &rhs)
const_result_iterator & | operator= (const_result_iterator &&rhs)
const_result_iterator | operator++ (int) &
const_result_iterator & | operator++ ()
const_result_iterator | operator-- (int) &
const_result_iterator & | operator-- ()
const_result_iterator & | operator+= (difference_type i)
const_result_iterator & | operator-= (difference_type i)
void | swap (const_result_iterator &other) noexcept
| Interchange two iterators in an exception-safe manner.
Comparisons
bool | operator== (const_result_iterator const &i) const
bool | operator!= (const_result_iterator const &i) const
bool | operator< (const_result_iterator const &i) const
bool | operator<= (const_result_iterator const &i) const
bool | operator> (const_result_iterator const &i) const
bool | operator>= (const_result_iterator const &i) const
Field access
reference | back () const noexcept
reference | front () const noexcept
reference | at (size_type) const
reference | at (zview col_name) const
constexpr result::size_type | rownumber () const noexcept
| Row number, assuming this is a real row and not end()/rend().
Public Member Functions inherited from pqxx::row
| row (row &&) noexcept=default
| row (row const &) noexcept=default
row & | operator= (row const &) noexcept=default
row & | operator= (row &&) noexcept=default
PQXX_PURE bool | operator== (row const &) const noexcept
bool | operator!= (row const &rhs) const noexcept
const_iterator | begin () const noexcept
const_iterator | cbegin () const noexcept
const_iterator | end () const noexcept
const_iterator | cend () const noexcept
reference | front () const noexcept
reference | back () const noexcept
const_reverse_row_iterator | rbegin () const noexcept
const_reverse_row_iterator | crbegin () const noexcept
const_reverse_row_iterator | rend () const noexcept
const_reverse_row_iterator | crend () const noexcept
reference | operator[] (size_type) const noexcept
reference | operator[] (zview col_name) const
reference | at (size_type) const
reference | at (zview col_name) const
constexpr size_type | size () const noexcept
constexpr result::size_type | rownumber () const noexcept
| Row number, assuming this is a real row and not end()/rend().
size_type | column_number (zview col_name) const
| Number of given column (throws exception if it doesn't exist).
oid | column_type (size_type) const
| Return a column's type.
oid | column_type (zview col_name) const
| Return a column's type.
oid | column_table (size_type col_num) const
| What table did this column come from?
oid | column_table (zview col_name) const
| What table did this column come from?
size_type | table_column (size_type) const
| What column number in its table did this result column come from?
size_type | table_column (zview col_name) const
| What column number in its table did this result column come from?
constexpr result::size_type | num () const noexcept
template<typename Tuple >
void | to (Tuple &t) const
| Extract entire row's values into a tuple.
template<typename... TYPE>
std::tuple< TYPE... > | as () const
| Extract entire row's values into a tuple.
void | swap (row &) noexcept
row | slice (size_type sbegin, size_type send) const
PQXX_PURE bool | empty () const noexcept
| Is this a row without fields? Can only happen to a slice.

## Arithmetic operators

class | pqxx::result
const_result_iterator | operator+ (difference_type, const_result_iterator const &)
const_result_iterator | operator+ (difference_type) const
const_result_iterator | operator- (difference_type) const
difference_type | operator- (const_result_iterator const &) const

## Additional Inherited Members

Protected Member Functions inherited from pqxx::row
| row (result r, result_size_type index, size_type cols) noexcept
void | check_size (size_type expected) const
| Throw usage_error if row size is not `expected`.
template<typename TUPLE >
TUPLE | as_tuple () const
| Convert to a given tuple of values, don't check sizes.
template<typename Tuple >
void | convert (Tuple &t) const
| Convert entire row to tuple fields, without checking row size.
Protected Attributes inherited from pqxx::row
result | m_result
| Result set of which this is one row.
result::size_type | m_index = 0
| Row number.
size_type | m_begin = 0
| First column in slice. This row ignores lower-numbered columns.
size_type | m_end = 0
| End column in slice. This row only sees lower-numbered columns.

## Detailed Description

Iterator for rows in a result. Use as result::const_iterator.

A result, once obtained, cannot be modified. Therefore there is no plain iterator type for result. However its const_iterator type can be used to inspect its rows without changing them.

## Member Function Documentation

## at()

pqxx::field pqxx::row::at | ( | zview | col_name | ) | const

Address field by name.

Warning
  This is much slower than indexing by number, or iterating.

The documentation for this class was generated from the following files:

- /build/libpqxx-dRO3di/libpqxx-7.10.0/include/pqxx/internal/result_iterator.hxx
- /build/libpqxx-dRO3di/libpqxx-7.10.0/src/result.cxx