DeeResultSet

DeeResultSet — Cursor-like interface for results sets

Synopsis

#include <dee.h>

struct              DeeResultSetIface;
DeeModel *          dee_result_set_get_model            (DeeResultSet *self);
guint               dee_result_set_get_n_rows           (DeeResultSet *self);
gboolean            dee_result_set_has_next             (DeeResultSet *self);
DeeModelIter *      dee_result_set_next                 (DeeResultSet *self);
DeeModelIter *      dee_result_set_peek                 (DeeResultSet *self);
void                dee_result_set_seek                 (DeeResultSet *self,
                                                         guint pos);
guint               dee_result_set_tell                 (DeeResultSet *self);

Description

Interface for results returned by dee_index_lookup().

This interface utilizes a cursor-like metaphor. You advance the cursor by calling dee_result_set_next() or adjust it manually by calling dee_result_set_seek().

Calling dee_result_set_next() will also return the row at the current cursor position. You may retrieve the current row without advancing the cursor by calling dee_result_set_peek().

Details

struct DeeResultSetIface

struct DeeResultSetIface {
  GTypeInterface g_iface;

  guint           (*get_n_rows)        (DeeResultSet *self);

  DeeModelIter*   (*next)              (DeeResultSet *self);

  gboolean        (*has_next)          (DeeResultSet *self);
  
  DeeModelIter*   (*peek)              (DeeResultSet *self);

  void            (*seek)              (DeeResultSet *self,
                                        guint         pos);

  guint           (*tell)              (DeeResultSet *self);

  DeeModel*       (*get_model)         (DeeResultSet *self);
};


dee_result_set_get_model ()

DeeModel *          dee_result_set_get_model            (DeeResultSet *self);

Get the model associated with a result set

self :

The DeeResultSet to get the mode for

Returns :

The model that the rows point into. [transfer none]

dee_result_set_get_n_rows ()

guint               dee_result_set_get_n_rows           (DeeResultSet *self);

Get the number of DeeModelIters held in a DeeResultSet.

self :

The DeeResultSet to get the size of

Returns :

The number of rows held in the result set

dee_result_set_has_next ()

gboolean            dee_result_set_has_next             (DeeResultSet *self);

Check if a call to dee_result_set_next() will succeed.

self :

The DeeResultSet to check

Returns :

TRUE if and only if more rows can be retrieved by calling dee_result_set_next()

dee_result_set_next ()

DeeModelIter *      dee_result_set_next                 (DeeResultSet *self);

Get the current row from the result set and advance the cursor. To ensure that calls to this method will succeed you can call dee_result_set_has_next().

To retrieve the current row without advancing the cursor call dee_result_set_peek() in stead of this method.

self :

The DeeResultSet to get a row from

Returns :

The DeeModelIter at the current cursor position. [transfer none]

dee_result_set_peek ()

DeeModelIter *      dee_result_set_peek                 (DeeResultSet *self);

Get the row at the current cursor position.

To retrieve the current row and advance the cursor position call dee_result_set_next() in stead of this method.

self :

The DeeResultSet to get a row from

Returns :

The DeeModelIter at the current cursor position. [transfer none]

dee_result_set_seek ()

void                dee_result_set_seek                 (DeeResultSet *self,
                                                         guint pos);

Set the cursor position. Following calls to dee_result_set_peek() or dee_result_set_next() will read the row at position pos.

self :

The DeeResultSet to seek in

pos :

The position to seek to

dee_result_set_tell ()

guint               dee_result_set_tell                 (DeeResultSet *self);

Get the current position of the cursor.

self :

The DeeResultSet to check the cursor position for

Returns :

The current position of the cursor