Save sets

Save sets provide a mechanism for a DataBlade® API module to access several rows simultaneously.

When a DataBlade® API module retrieves rows from a cursor in an mi_next_row() loop, only one row is current at a time. Each iteration of mi_next_row() overwrites the row from the previous iteration. If your DataBlade® API module needs to perform comparisons or other types of processing on more than one row, you can save the rows in a save set. The DataBlade® API maintains a save set as a first-in, first-out (FIFO) queue.

The DataBlade® API provides the save-set structure, MI_SAVE_SET, to hold the rows of a save set. The following table summarizes the memory operations for a save-set structure.
Memory duration Memory operation Function name
PER_STMT_EXEC Constructor mi_save_set_create()
PER_STMT_EXEC Destructor mi_save_set_destroy()
The following table lists the functions that the DataBlade® API provides for use with a save set.
Table 1. Save-set functions of the DataBlade® API
Save-set operation DataBlade® API function
Determine the number of rows in a save set mi_save_set_count()
Create a new save set mi_save_set_create()
Delete a row from a save set mi_save_set_delete()
Free resources associated with a save set mi_save_set_destroy()
Get first row from a save set mi_save_set_get_first()
Get last row from a save set mi_save_set_get_last()
Get next row from a save set mi_save_set_get_next()
Get previous row from a save set mi_save_set_get_previous()
Insert a new row into the save set mi_save_set_insert()
Determine if a specified row is a member of a save set mi_save_set_member()