Execute the mi_get_result() loop
The mi_get_result() function is usually executed in a loop after one of the DataBlade® API statement-execution functions sends a statement to the database server. The function is normally called in the outermost loop of row-retrieval code. This loop executes for each of several states of the database server as it processes statement results. These states are represented as the status of the current statement.
For a list of statement-execution functions see Statement-execution functions of the DataBlade API.
Information about current SQL statement | Statement-status constant |
---|---|
The current statement has generated an error. | MI_ERROR |
The current statement is a data definition (DDL) statement that has completed successfully. | MI_DDL |
The current statement is a data manipulation (DML) statement that has completed successfully. | MI_DML |
The current statement is a query that has executed successfully. | MI_ROWS |
No more results are pending for the current statement. | MI_NO_MORE_RESULTS |
You can use a switch statement based on these statement-status constants to determine how to handle the status of the current statement. The mi_get_result() loop terminates when mi_get_result() returns the status MI_NO_MORE_RESULTS. Think of the mi_get_result() loop as an iteration over the states of the database server.