The mi_parameter_count() function

The mi_parameter_count() function returns the number of input parameters in a prepared statement.

Syntax

mi_integer mi_parameter_count(stmt_desc)
   MI_STATEMENT *stmt_desc;
stmt_desc
A pointer to the statement descriptor for a prepared statement.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_parameter_count() function obtains the number of input parameters in the statement descriptor that stmt_desc references. A statement descriptor describes a prepared statement. You can use the mi_parameter_count() function with the DataBlade® API functions that obtain information about each input parameter of the prepared statement (such as mi_parameter_type_id() and mi_parameter_nullable()).

Parameter information is available only for the INSERT and UPDATE statements. Support for the UPDATE statement includes the following forms of UPDATE:
  • UPDATE with or without a WHERE clause
  • UPDATE WHERE CURRENT OF

If you attempt to request parameter information for other SQL statements, mi_parameter_count() raises an exception.

Return values

>=0
The number of input parameters contained in the text of the prepared statement.
MI_ERROR
The function was not successful.