9#ifndef HEADER_SQLITEPP_ROW_ITERATOR_INCLUDED 
   10#define HEADER_SQLITEPP_ROW_ITERATOR_INCLUDED 
   12#include "statement_iface.hpp" 
   40            _owner(owner), _idx(idx)
 
 
   44            cell(owner.get(), idx)
 
 
   69        const char * 
name() const noexcept
 
 
   83        template<
class T> T 
value() const noexcept
 
 
 
  146        using size_type = int;
 
  147        using difference_type = int;
 
  149        using pointer = void;
 
  151        class const_iterator : 
private cell 
  156            using size_type = row::size_type;
 
  157            using difference_type = row::difference_type;
 
  159            using pointer = row::pointer;
 
  162            const_iterator() 
noexcept:
 
  166            cell operator*() 
const noexcept 
  168            const cell * operator->() 
const noexcept 
  170            cell operator[](size_type idx) 
const noexcept 
  171                { 
return *(*
this + idx); }
 
  173            const_iterator & operator++() 
noexcept 
  174                { ++_idx; 
return *
this; }
 
  175            const_iterator operator++(
int) 
noexcept 
  176                { 
return const_iterator(_owner, _idx++);  }
 
  177            const_iterator & operator+=(
int val) 
noexcept 
  178                { _idx += val; 
return *
this; }
 
  179            const_iterator & operator--() 
noexcept 
  180                { --_idx; 
return *
this; }
 
  181            const_iterator operator--(
int) 
noexcept 
  182                { 
return const_iterator(_owner, _idx--);  }
 
  183            const_iterator & operator-=(
int val) 
noexcept 
  184                { _idx -= val; 
return *
this; }
 
  186            friend const_iterator operator+(
const const_iterator & lhs, 
int rhs) 
noexcept 
  187                { 
return const_iterator(lhs._owner, lhs._idx + rhs); }
 
  188            friend const_iterator operator+(
int lhs, 
const const_iterator & rhs) 
noexcept 
  189                { 
return const_iterator(rhs._owner, rhs._idx + lhs); }
 
  191            friend int operator-(
const const_iterator & lhs, 
const const_iterator & rhs) 
noexcept 
  192                { 
return lhs._idx - rhs._idx; }
 
  193            friend const_iterator operator-(
const const_iterator & lhs, 
int rhs) 
noexcept 
  194                { 
return const_iterator(lhs._owner, lhs._idx - rhs); }
 
  196            friend bool operator==(
const const_iterator & lhs, 
const const_iterator & rhs) 
noexcept 
  197                { 
return lhs._idx == rhs._idx; }
 
  198            friend bool operator!=(
const const_iterator & lhs, 
const const_iterator & rhs) 
noexcept 
  199                { 
return lhs._idx != rhs._idx; }
 
  200            friend bool operator<(
const const_iterator & lhs, 
const const_iterator & rhs) 
noexcept 
  201                { 
return lhs._idx < rhs._idx; }
 
  202            friend bool operator<=(
const const_iterator & lhs, 
const const_iterator & rhs) 
noexcept 
  203                { 
return lhs._idx <= rhs._idx; }
 
  204            friend bool operator>(
const const_iterator & lhs, 
const const_iterator & rhs) 
noexcept 
  205                { 
return lhs._idx > rhs._idx; }
 
  206            friend bool operator>=(
const const_iterator & lhs, 
const const_iterator & rhs) 
noexcept 
  207                { 
return lhs._idx >= rhs._idx; }
 
  209            const_iterator(
const statement * owner, 
int idx) 
noexcept:
 
  213        using iterator = const_iterator;
 
  231        int size() const noexcept
 
  233        bool empty() const noexcept
 
  234            { 
return size() == 0; }
 
  236        cell operator[](
int idx) 
const noexcept 
  237            { 
return cell(_owner, idx); }
 
  239        const_iterator begin() const noexcept
 
  240            { 
return const_iterator(_owner, 0); }
 
  241        const_iterator cbegin() const noexcept
 
  242            { 
return const_iterator(_owner, 0); }
 
  243        const_iterator end() const noexcept
 
  244            { 
return const_iterator(_owner, size()); }
 
  245        const_iterator cend() const noexcept
 
  246            { 
return const_iterator(_owner, size()); }
 
  248        const_reverse_iterator rbegin() const noexcept
 
  249            { 
return const_reverse_iterator(end()); }
 
  250        const_reverse_iterator crbegin() const noexcept
 
  251            { 
return const_reverse_iterator(end()); }
 
  252        const_reverse_iterator rend() const noexcept
 
  253            { 
return const_reverse_iterator(begin()); }
 
  254        const_reverse_iterator crend() const noexcept
 
  255            { 
return const_reverse_iterator(begin()); }
 
  257        const statement * _owner;
 
 
  273        using size_type = int;
 
  274        using difference_type = int;
 
  276        using pointer = void;
 
  306        row operator*() const noexcept
 
  309        const row * operator->() const noexcept
 
  313            { increment(); 
return *
this; }
 
  315            { increment(); 
return *
this; }
 
  318            { 
return lhs._owner == rhs._owner; }
 
  320            { 
return lhs._owner != rhs._owner; }
 
  324            if (!
const_cast<statement *
>(_owner)->step())
 
 
  341        using size_type = int;
 
  342        using difference_type = int;
 
  344        using pointer = void;
 
  364        const_iterator begin() const noexcept
 
  366        const_iterator cbegin() const noexcept
 
  368        const_iterator end() const noexcept
 
  369            { 
return const_iterator(); }
 
  370        const_iterator cend() const noexcept
 
  371            { 
return const_iterator(); }
 
 
A cell in a row.
Definition row_iterator.hpp:34
 
const char * origin_name() const noexcept
Table column that is the origin of the cell.
Definition row_iterator.hpp:112
 
const char * name() const noexcept
Name of the cell's column.
Definition row_iterator.hpp:69
 
cell(const statement *owner, int idx) noexcept
Construct a cell for a given statement and column index.
Definition row_iterator.hpp:39
 
const char * database_name() const noexcept
Database that is the origin of the cell.
Definition row_iterator.hpp:93
 
const char * table_name() const noexcept
Table that is the origin of the cell.
Definition row_iterator.hpp:102
 
const char * declared_type() const noexcept
Declared datatype of the cell.
Definition row_iterator.hpp:122
 
T value() const noexcept
Cell's value.
Definition row_iterator.hpp:83
 
int type() const noexcept
Default datatype of the cell.
Definition row_iterator.hpp:55
 
cell(const std::unique_ptr< statement > &owner, int idx) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition row_iterator.hpp:43
 
A forward iterator for statement results.
Definition row_iterator.hpp:270
 
row_iterator() noexcept
Create an empty iterator.
Definition row_iterator.hpp:285
 
row_iterator(std::unique_ptr< statement > &owner)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition row_iterator.hpp:302
 
row_iterator(statement *owner)
Create an instance referring to a given statement.
Definition row_iterator.hpp:294
 
A forward range for statement results.
Definition row_iterator.hpp:338
 
row_range(std::unique_ptr< statement > &owner)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition row_iterator.hpp:360
 
row_range(statement *owner)
Create an instance referring to a given statement.
Definition row_iterator.hpp:355
 
Row result of a statement.
Definition row_iterator.hpp:143
 
row(const statement *owner) noexcept
Construct a row for a given statement.
Definition row_iterator.hpp:223
 
row(const std::unique_ptr< statement > &owner) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition row_iterator.hpp:227
 
Prepared Statement Object.
Definition statement_iface.hpp:41
 
int column_type(int idx) const noexcept
Default datatype of the result column.
Definition statement_iface.hpp:483
 
const char * column_table_name(int idx) const noexcept
Table that is the origin of a result column.
Definition statement_iface.hpp:512
 
const char * column_origin_name(int idx) const noexcept
Table column that is the origin of a result column.
Definition statement_iface.hpp:520
 
const char * column_database_name(int idx) const noexcept
Database that is the origin of a result column.
Definition statement_iface.hpp:504
 
const char * column_name(int idx) const noexcept
Name of the result column.
Definition statement_iface.hpp:496
 
T column_value(int idx) const noexcept
Get result value from a query.
 
const char * column_declared_type(int idx) const noexcept
Declared datatype of a result column.
Definition statement_iface.hpp:528
 
int data_count() const noexcept
Number of columns in a result set.
Definition statement_iface.hpp:427
 
ThinSQLite++ namespace.
Definition backup_iface.hpp:17