Execute the mi_next_row() loop
The mi_next_row() function is usually the middle loop of row-retrieval code. In the mi_next_row() loop, each call to mi_next_row() returns one query row from the cursor that is associated with the current statement. This query row is the current row only until the next iteration of the loop, when mi_next_row() retrieves another row from the cursor. This loop terminates when mi_next_row() returns a NULL-valued pointer and its error argument is zero. These conditions indicate either that no more rows exist in the cursor or that the cursor is empty. Think of the mi_next_row() loop as an iteration over the matching rows of the query.
The mi_next_row() function allocates memory for the row structure that it returns. To free this row structure, you must complete the query.
- The mi_next_row() loop continues until no more rows exist in the cursor. That is, mi_next_row() returns a NULL-valued pointer.
- You terminate the mi_get_result() loop prematurely with a call to mi_query_finish() or mi_query_interrupt().