WYRDTEK Home Features Reference Downloads About


Reference/es_mbi_beginfetch

Syntax

int es_mbi_beginfetch( struct es_mbi *iter, struct es_mbn *nd );

Arguments

struct es_mbi *iter Database node iterator.
struct es_mbn *nd Database node.

Return Codes

ES_ERROR_NONE Success. No errors.
ES_ERROR_INVALIDBINDING The field-binding associated with iter is for a class that is not the same (or a valid super class) as that of the node nd.
ES_ERROR_FAILTOFIND Database node nd is empty.

Description

Set iterator iter to point at first row in database node nd and fetch row contents. Returns ES_ERROR_FAILTOFIND if nd is empty.

If one or more membership filters ( struct es_mbm ) have been added to the associated iterator field-binding ( struct es_mbb ) es_mbi_beginfetch() will instead point to the first row for which the filters are valid.

Equivalent to calling es_mbi_begininit() followed by es_mbi_incfetch().

es_mbi_incfetch() can be used subsequently to advance iter to the next row in the node.

es_mbi_beginfetch() and es_mbi_incfetch() are typically used together to iterate over all the rows in a node via a for loop:

  int r;
  for( r = es_mbi_beginfetch( iter, nd ); r == ES_ERROR_NONE;
       r = es_mbi_incfetch( iter ) ) {

    /* do useful work with the data for this row */

  }

[Back To Reference] [Back To Reference/es_mbi]