Use this section as a guide for entering SQL statement parameters with IIapi_query(). It also provides valid column and data types for parameters when sending data formats with IIapi_setDescriptor().
Each SQL statement invoked with IIapi_query() may or may not have query parameters associated with it. In general, query input parameters are needed when:
The table in this section lists the query types for SQL statements that can have query parameters associated with them. The first three columns provide information for sending an SQL statement to the DBMS Server. The Query Type column lists valid entries for the qy_queryType parameter of IIapi_query(). The Query Text? column indicates whether a query text entry is required in the qy_queryText parameter of IIapi_query(). Query text is not required for some SQL statements because OpenAPI can construct the query text based solely on the query type.
When SQL statements require query parameters, the application invokes IIapi_query() and then enters the parameters in subsequent calls to IIapi_setDescriptor() and IIapi_putParms(). The Query Input Parameters column indicates what parameters are needed.
Note: For a description of SQL statements and their parameters, see the SQL Reference Guide.
When an application calls IIapi_getQueryInfo(), it receives information about the status of a previously-invoked SQL statement. For some statements, IIapi_getQueryInfo() also returns available response data in the gq_mask parameter. This information is given for applicable SQL statements in the Result Parameters column of the table.
Query Type |
Query Text? |
Query Input Parameters |
Result Parameters |
|---|---|---|---|
API_QT_EXEC |
Yes * |
[dynamic parameter values] |
|
API_QT_OPEN |
Yes * |
[cursor name] |
IIAPI_GQ_CURSOR |
API_QT_CURSOR_ |
Yes * |
Cursor ID |
|
API_QT_CURSOR_ |
Yes * |
Cursor ID |
IIAPI_GQ_TABLE_KEY or |
API_QT_DEFINE_ |
Yes * |
[repeat query ID] |
IIAPI_GQ_REPEAT_ |
API_QT_EXEC_ |
No |
Repeat query handle |
|
API_QT_EXEC_ |
No |
Procedure name or |
IIAPI_GQ_PROCEDURE_ |
API_QT_QUERY |
Yes |
[parameter values] |
|
API_QT_SELECT_ |
Yes |
[parameter values] |
|
* The query syntax for these statements differs from that used in embedded SQL. See SQL Syntax. |
|||
When an application calls IIapi_setDescriptor() to send information to the DBMS Server about parameter formats, it should make sure that the sd_descriptor parameter contains the appropriate column type and data type for each query parameter of an SQL statement.
The following table provides query parameters and their corresponding ds_columnType and ds_dataType values in the API_DESCRIPTOR structure:
Query Parameters |
Descriptor Column Type |
Data Type |
|---|---|---|
Cursor name |
IIAPI_COL_SVCPARM |
IIAPI_CHA_TYPE |
Cursor ID |
IIAPI_COL_SVCPARM |
IIAPI_APIHNDL_TYPE |
Procedure ID |
IIAPI_COL_SVCPARM |
IIAPI_HNDL_TYPE |
Procedure name |
IIAPI_COL_SVCPARM |
IIAPI_CHA_TYPE |
Procedure owner |
IIAPI_COL_SVCPARM |
IIAPI_CHA_TYPE |
Procedure parameters |
IIAPI_COL_PROCPARM |
Any of the Ingres data types in Ingres Data Types the "Data Types" appendix |
Parameter values |
IIAPI_COL_QPARM |
Any of the Ingres data types in Ingres Data Types the "Data Types" appendix |
Repeat query ID |
IIAPI_COL_SVCPARM |
IIAPI_INT_TYPE |
Repeat query handle |
IIAPI_COL_SVCPARM |
IIAPI_APIHNDL_TYPE |
Repeat query parameters |
IIAPI_COL_QPARM |
Any of the Ingres data types in Ingres Data Types the "Data Types" appendix |
Dynamic parameter values |
IIAPI_COL_QPARM |
Any of the Ingres data types in Ingres Data Types the "Data Types" appendix |