The mi_statement_command_name() function

The mi_statement_command_name() function returns the name of an SQL prepared statement.

Syntax

mi_string *mi_statement_command_name(stmt_desc)
   MI_STATEMENT *stmt_desc;
stmt_desc
A statement descriptor that the mi_prepare() function returned.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_statement_command_name() function returns the SQL statement name in the prepared statement that stmt_desc references. The function returns the name as a null-terminated string in memory that it 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_prepare() statement had prepared the following SELECT statement:
SELECT * FROM customer WHERE state = "CA";
The mi_statement_command_name() returns only the verb of this statement: select.
Important: Use the mi_statement_command_name() function only for prepared statements. To obtain the name of the current statement, use the mi_statement_command_name() function after the mi_get_result() function returns MI_DML or MI_DDL. To obtain the name of the SQL statement that has invoked a C UDR, use the mi_statement_command_name() function.

The function returns the statement verb as a null-terminated string in a buffer that it allocates.

Return values

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