informix
Informix DataBlade API Programmer's Manual
DataBlade API Function Descriptions

mi_prepare()

The mi_prepare() function sends an SQL statement to the database server to be prepared and returns a statement descriptor for the prepared statement.

Syntax

Usage

The mi_prepare() function sends the SQL statement in the stmt_strng statement string to the database server. The database server parses and optimizes the statement string and builds the necessary internal structures for a prepared statement. This function is the constructor for the statement descriptor (MI_STATEMENT).

The stmt_strng statement string can contain input parameters to indicate where column or expression values will be provided at runtime. Specify input parameters within the statement string with the question-mark symbol (?).

The mi_prepare() function does not allocate a new statement descriptor from memory-duration pools. For information about the scope of a statement descriptor, see Dropping a Prepared Statement.

Once you have a statement descriptor, you can obtain the following information about the prepared statement.

Prepared-Statement Information DataBlade API Functions
Input parameters Input-parameter accessor functions
(which begin with "mi_parameter_")
Columns (from the row descriptor) Column accessor functions
(which begin with "mi_column_")

For more information about information in a statement descriptor, see Figure 8-7 on page 8-20.

Return Values

MI_STATEMENT * is a pointer to a statement descriptor for the SQL statement in stmt_strng.
NULL indicates that the function was not successful.

Related Topics

See the descriptions of the following functions: mi_column_count(), mi_column_id(), mi_column_name(), mi_column_nullable(), mi_column_precision(), mi_column_scale(), mi_column_type_id(), mi_column_typedesc(), mi_exec_prepared_statement(), mi_fetch_statement(), mi_get_statement_row_desc(), mi_open_prepared_statement(), mi_parameter_count(), mi_parameter_nullable(), mi_parameter_precision(), mi_parameter_scale(), mi_parameter_type_id(), mi_parameter_type_name(), and mi_statement_command_name().


Informix DataBlade API Programmer's Manual, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved