The mi_current_command_name() function

The mi_current_command_name() function returns the name of the SQL statement that invoked the C UDR.

Syntax

mi_string *mi_current_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?
No Yes

Usage

The mi_current_command_name() function returns the SQL statement name as a null-terminated string in memory that the function allocates with the current memory duration. This statement name is only the verb of the statement, not the entire statement syntax.

For example, suppose the following statement executes:
DELETE FROM customer WHERE customer_id = 1998;

The mi_current_command_name() function returns only the verb of this statement: delete.

The conn parameter is redundant when you call mi_current_command_name() within the context of a user-defined routine. This function is useful in a user-defined routine that needs to determine what kind of SQL statement invoked it.
Important: The mi_current_command_name() function does not return the name of the current SQL statement or of an SQL prepared statement. To obtain the name of the current SQL statement, use the mi_result_command_name() function after the mi_get_result() function returns MI_DML or MI_DDL. To return the name of an SQL prepared statement, you can use the mi_statement_command_name() function.

For more information about how to call a C UDR with an SQL statement, see the HCL OneDB™ DataBlade® API Programmer's Guide.

Return values

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