A RowReader is a class which helps reading multiple columns from a row.
More...
#include <rowreader.h>
|
| RowReader (const Row &row_, Row::size_type field_num_=0) |
| instatiates a row reader with a row and a initial field counter More...
|
|
template<typename T > |
RowReader & | get (T &ret) |
| Reads the current column value and increments the field counter. More...
|
|
template<typename T > |
RowReader & | get (T &ret, bool &nullInd) |
| Reads the current column value and a null indicator and increments the field counter. More...
|
|
RowReader & | get (tntdb::Value &v) |
| Reads the current value into a tntdb::Value and increments the field counter. More...
|
|
bool | isNull () const |
| Returns true, if the current value is null. More...
|
|
void | rewind (Row::size_type n_=0) |
| Resets the field counter to the passed value. More...
|
|
const Row & | currentRow () const |
| returns the underlying row. More...
|
|
Row::size_type | currentCol () const |
| returns the current column number. More...
|
|
Row::size_type | operator++ () |
| increments the current column number and returns the incremented value (pre increment). More...
|
|
Row::size_type | operator++ (int) |
| increments the current column number and returns the previous value (post increment). More...
|
|
Row::size_type | operator-- () |
| decrements the current column number and returns the decremented value (pre decrement). More...
|
|
Row::size_type | operator-- (int) |
| decrements the current column number and returns the previous value (post decrement). More...
|
|
A RowReader is a class which helps reading multiple columns from a row.
This class helds a field number counter, which is incremented each time a value is fetched from the underlying row using one of the get methods. This class is normally instantiated implicitly using the tntdb::Row::reader method.
The get methods return a reference to the row reader to make chaining of calls easy.
Example:
{
int col1;
std::string col2;
long col3;
bool col3IsNotNull;
cur->reader().get(col1)
.get(col2)
.get(col3, col3IsNotNull);
}
tntdb::RowReader::RowReader |
( |
const Row & |
row_, |
|
|
Row::size_type |
field_num_ = 0 |
|
) |
| |
|
inlineexplicit |
instatiates a row reader with a row and a initial field counter
Row::size_type tntdb::RowReader::currentCol |
( |
| ) |
const |
|
inline |
returns the current column number.
const Row& tntdb::RowReader::currentRow |
( |
| ) |
const |
|
inline |
returns the underlying row.
Reads the current column value and increments the field counter.
If the value is null, the passed variable is not changed. There is no straight forward way to determine, whether the value was null. You should use the get method with the null indicator, if the value might be null or just initialize your value with a suitable default.
template<typename T >
RowReader& tntdb::RowReader::get |
( |
T & |
ret, |
|
|
bool & |
nullInd |
|
) |
| |
|
inline |
Reads the current column value and a null indicator and increments the field counter.
If the value is null, the null indicator is set to false and the actual value of the passed variable is not changed.
Reads the current value into a tntdb::Value and increments the field counter.
bool tntdb::RowReader::isNull |
( |
| ) |
const |
|
inline |
Returns true, if the current value is null.
Row::size_type tntdb::RowReader::operator++ |
( |
| ) |
|
|
inline |
increments the current column number and returns the incremented value (pre increment).
Row::size_type tntdb::RowReader::operator++ |
( |
int |
| ) |
|
|
inline |
increments the current column number and returns the previous value (post increment).
Row::size_type tntdb::RowReader::operator-- |
( |
| ) |
|
|
inline |
decrements the current column number and returns the decremented value (pre decrement).
Row::size_type tntdb::RowReader::operator-- |
( |
int |
| ) |
|
|
inline |
decrements the current column number and returns the previous value (post decrement).
void tntdb::RowReader::rewind |
( |
Row::size_type |
n_ = 0 | ) |
|
|
inline |
Resets the field counter to the passed value.
The documentation for this class was generated from the following file: