The mi_result_command_name() function

The mi_result_command_name() function returns the name of the SQL statement that is the current statement.

Syntax

char *mi_result_command_name(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_result_command_name() function returns the name of 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. The function returns the name as a null-terminated string in memory that it has allocated in the current memory duration. This statement name is only the verb of the statement, not the entire statement syntax.

For example, suppose the mi_exec() function sends the following SELECT statement to the database server over the conn connection:
SELECT * FROM customer WHERE state = "CA";
The following call to mi_result_command_name() returns only the verb of this statement: select:
char *cmd_name;
...
cmd_name = mi_result_command_name(conn);
Important: Use the mi_result_command_name() function only after the mi_get_result() function returns MI_DML or MI_DDL. To obtain the name of the SQL statement that invoked a C UDR, use the mi_current_command_name() function. To obtain the statement name of a prepared statement, use the mi_statement_command_name() function.

Return values

An mi_string pointer
A pointer to the verb of the last statement or command.
NULL
The function was not successful.