Retrieving Rows from a Save Set
The user function build_saveset() creates a save set and inserts rows into it. It is called when mi_get_result() returns MI_ROWS and the application wants to store the rows temporarily in a save set. Another user function, get_saveset_data(), is called to access and manipulate the data in the save set.
Once the save set is built, get_saveset_data() can traverse the save set as a FIFO queue. The function mi_save_set_get_first() retrieves the first element of the set and positions the application at the beginning of the set. The application can scan forward through the set with mi_save_set_get_next() and then backward with calls to mi_save_set_get_previous(). All of these functions return a row (MI_ROW) from the save set.
When a row is obtained, its values are extracted using an mi_value() loop as demonstrated in "Example: get_data()". Functions also exist for retrieving the number of rows in a save set ((mi_save_set_count()) and determining if a given row is a member of a save set (mi_save_set_member()).
The following function, get_saveset_data(), traverses the save set:
|