Row Class Reference

#include <Pt/Db/Row.h>

One row of a buffered query result. More...

Classes

class  ConstIterator
 Random-access iterator over the values of a Row. More...

Public Member Functions

 Row ()
 Creates an unbound row.
 Row (IRow *row_)
 Takes ownership of the backend row_.
size_type size () const
 Returns the number of columns.
bool empty () const
 Returns true if this row has no columns.
Value getValue (size_type field_num) const
 Returns the value at field_num without range checking.
Value operator[] (size_type field_num) const
 Returns the value at field_num without range checking.
bool isNull (size_type field_num) const
 Returns true if the value at field_num is SQL NULL.
bool getBool (size_type field_num) const
 Returns the value at field_num as bool.
int getInt (size_type field_num) const
 Returns the value at field_num as int.
unsigned getUnsigned (size_type field_num) const
 Returns the value at field_num as unsigned.
float getFloat (size_type field_num) const
 Returns the value at field_num as float.
double getDouble (size_type field_num) const
 Returns the value at field_num as double.
char getChar (size_type field_num) const
 Returns the value at field_num as char.
std::string getString (size_type field_num) const
 Returns the value at field_num as string.
ConstIterator begin () const
 Returns a random-access iterator to the first column.
ConstIterator end () const
 Returns a random-access iterator past the last column.
bool operator! () const
 Returns true if this object is not bound to a row.
const IRowgetImpl () const
 Returns the backend implementation.

Detailed Description

Row is one row of a Result. Columns are addressed by index. It is a shared value. An unbound row is empty; operator!() is true then.

size() is the column count. empty() is true when there are no columns. getValue() and operator[] return a Value without range checking. Typed getters convert that column. isNull() reports SQL NULL at an index. A null or a conversion that cannot be performed throws TypeMismatch. begin() and end() are random-access iterators over the values.

Member Function Documentation

◆ getBool()

bool getBool ( size_type field_num) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getInt()

int getInt ( size_type field_num) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getUnsigned()

unsigned getUnsigned ( size_type field_num) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getFloat()

float getFloat ( size_type field_num) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getDouble()

double getDouble ( size_type field_num) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getChar()

char getChar ( size_type field_num) const

If the value is a string, the first character is returned.

Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getString()

std::string getString ( size_type field_num) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.