Result Class Reference

#include <Pt/Db/Result.h>

Buffered query result with random-access rows. More...

Classes

class  ConstIterator
 Random-access iterator over the rows of a Result. More...

Public Member Functions

 Result ()
 Creates an unbound result.
 Result (IResult *res)
 Takes ownership of the backend res.
Row getRow (size_type row_num) const
 Returns the row at row_num without range checking.
Value getValue (size_type row_num, size_type field_num) const
 Returns the value at row_num, field_num without range checking.
size_type size () const
 Returns the number of rows.
bool empty () const
 Returns true if this result has no rows.
size_type getFieldCount () const
 Returns the number of columns.
Row operator[] (size_type row_num) const
 Returns the row at row_num without range checking.
ConstIterator begin () const
 Returns a random-access iterator to the first row.
ConstIterator end () const
 Returns a random-access iterator past the last row.
bool operator! () const
 Returns true if this object is not bound to a result.
const IResultgetImpl () const
 Returns the backend implementation.

Detailed Description

Result is the in-memory result the group described. Rows are addressed by index and visited with a random-access iterator. The set can be walked more than once. It is a shared value. An unbound result is empty; operator!() is true then.

size() is the number of rows. getFieldCount() is the number of columns. empty() is true when there are no rows. operator[] and getRow() return a Row without range checking. getValue() returns a column of a row the same way. begin() and end() are random-access iterators, so the result can be used with standard algorithms.

Once a Result is returned, the connection can run another statement. For a set that should not be fully buffered, use a Cursor.