Access the current row

The mi_next_row() function accesses rows in the cursor that is associated with the current statement.

Because a current statement is associated with a connection, you must pass a connection descriptor into mi_next_row() to identify the cursor to access. From this cursor, mi_next_row() obtains the current row. The current row is the row in the cursor that the cursor position identifies. Each time mi_next_row() retrieves a row, this cursor position moves by one. One cursor per connection is current and within this cursor, only one row at a time is current.

The mi_next_row() function returns the current row in an implicit row structure (MI_ROW structure). The row structure stores the column values of a single query row. The contents of this row structure are valid until mi_next_row() returns the next row. You can obtain column values from the row structure with the mi_value() or mi_value_by_name() function.

This implicit row structure is freed when the query is completed, which can occur in any of the following ways:
  • When mi_next_row() returns the NULL-valued pointer to indicate no more rows exist in the cursor
  • When the mi_query_finish() function executes
  • When the connection is closed