AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::sql::RowReader< T > Class Template Reference

Reader of the rows of a result set: columns are associated with fields once, when it is built. More...

#include <rows.hpp>

Collaboration diagram for anch::sql::RowReader< T >:

Public Member Functions

 RowReader (const ResultSet &result)
void read (ResultSet &result, T &row) const
T read (ResultSet &result) const

Detailed Description

template<anch::sql::Row T>
class anch::sql::RowReader< T >

Reader of the rows of a result set: columns are associated with fields once, when it is built.

Columns which are not fields are ignored, fields which are not columns keep their value. A Readable row is read from the first column.

Template Parameters
Tthe row type
Author
Vincent Lachenal
Since
0.3

Constructor & Destructor Documentation

◆ RowReader()

template<anch::sql::Row T>
anch::sql::RowReader< T >::RowReader ( const ResultSet & result)
explicit

RowReader constructor

Parameters
resultthe result set (its columns: SQLite and PostgreSQL know them once the first row has been fetched by ResultSet::next )
Exceptions
SqlExceptiona Readable row and a result set without column (non fatal)

Member Function Documentation

◆ read() [1/2]

template<anch::sql::Row T>
T anch::sql::RowReader< T >::read ( ResultSet & result) const

Read current row

Parameters
resultthe result set (on the row to read)
Returns
the row
Exceptions
SqlExceptioninvalid value, NULL value of a field (or row) which is not optional (non fatal), database error

◆ read() [2/2]

template<anch::sql::Row T>
void anch::sql::RowReader< T >::read ( ResultSet & result,
T & row ) const

Read current row

Parameters
resultthe result set (on the row to read)
rowthe row to fill
Exceptions
SqlExceptioninvalid value, NULL value of a field (or row) which is not optional (non fatal), database error

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