The mi_get_result() function

The mi_get_result() function returns the status of the current statement.

Syntax

mi_integer mi_get_result(conn)
   MI_CONNECTION *conn;
conn
A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_get_result() function provides the statement status for the current statement on the connection that conn references. The current statement is the most recently executed SQL statement sent to the database server on that connection. One of the DataBlade® API statement-execution functions sent the statement to the database server: mi_exec(), mi_exec_prepared_statement(), or mi_open_prepared_statement().

The mi_get_result() function classifies SQL statements as follows.
Type of SQL statement Statement-status constant
Statement is a data manipulation language (DML) statement MI_DML
Statement is a data definition language (DDL) statement MI_DDL
Statement produced rows of data that the DataBlade API program must fetch (SELECT or EXECUTE FUNCTION) MI_ROWS, MI_DML

The mi_get_result() function is typically executed in a loop that terminates when this function returns MI_NO_MORE_RESULTS. If mi_get_result() returns MI_ROWS, a query has executed and a cursor is ready to be accessed by the mi_next_row() function.

For more information about how to obtain results, see the HCL OneDB™ DataBlade API Programmer's Guide.

Return values

MI_NO_MORE_RESULTS
No more results pending.
MI_ROWS
The query has executed successfully and the cursor is available.
MI_DML
A Data Manipulation Language (DML) statement has completed.
MI_DDL
A Data Definition Language (DDL) statement has completed.
MI_ERROR
The function was not successful.