The mi_save_set_get_next() function

The mi_save_set_get_next() function traverses a save set in the forward direction.

Syntax

MI_ROW *mi_save_set_get_next(save_set, error)
   MI_SAVE_SET *save_set;
   mi_integer *error;
save_set
A pointer to an MI_SAVE_SET structure.
error
A pointer to a return code.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_save_set_get_next() function obtains the next row from the save set that save_set references. Because the DataBlade® API maintains a save set as an FIFO (first-in, first-out) queue, the next row is the row added to the save set before the current row. This save set must have been previously created with the mi_save_set_create() function.

When the mi_save_set_get_next() function is successful, it returns a pointer to the row structure for the next row. It also moves the cursor position to point to the next row as the current row in the save set. The mi_save_set_get_next() function is typically executed in a loop that terminates when no more rows remain to be fetched from the save-set cursor (the cursor position is at the end of the cursor). To indicate the “no more rows” condition, the function takes the following steps:
  1. Returns the NULL-valued pointer
  2. Sets the error argument to MI_NO_MORE_RESULTS

Return values

An MI_ROW pointer
A pointer to the next row forward in the specified save set.
NULL
The function was not successful or no more rows remain to be retrieved from the save-set cursor.

Upon failure, mi_save_set_get_next() returns NULL and sets error to MI_ERROR.