mi_integer mi_exec(conn, stmt_strng, control) MI_CONNECTION *conn; const mi_string *stmt_strng; mi_integer control;
Valid in Client LIBMI Application? | Valid in User-Defined Routine? |
---|---|
Yes | Yes |
The mi_exec( ) function performs the following tasks:
If the SQL statement is not a SELECT statement, the statement is executed. If it is SELECT, mi_exec( ) automatically creates and opens a cursor for the retrieved rows.
The mi_exec( ) function only sends the statement; it does not return results to the DataBlade API module. To get results after the execution of mi_exec( ), the DataBlade API module needs to execute the mi_get_result( ) function in a loop.
The current statement must finish before the database server can process the next statement. The mi_query_finish( ) function can be used to force a statement to finish processing. It is strongly advised that you use either mi_query_finish( ) or an mi_get_result( ) loop after each mi_exec( ) function.
For general information about how to send statements with mi_exec( ), see the IBM Informix: DataBlade API Programmer's Guide.
A successful return indicates only that the connection is valid and the statement was successfully executed (for statements other than SELECT) or a cursor was successfully opened (for SELECT). It does not indicate the success of the SQL statement. Use mi_get_result( ) to determine the success of the SQL statement.
See also the descriptions of mi_command_is_finished( ), mi_exec_prepared_statement( ), mi_get_result( ), mi_open_prepared_statement( ), and mi_query_finish( ).