Was this helpful?
Queries and Parameters
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:
An application specifies a dynamic parameter marker (?) in the query text
A procedure ID, procedure name, procedure owner, or procedure parameters are required for the SQL statement
A cursor ID or cursor name is required for the SQL statement
A repeat query ID, repeat query parameters, or repeat query handle is required for a repeated statement
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]
[dynamic parameter values]
IIAPI_GQ_CURSOR
API_QT_CURSOR_
DELETE
Yes *
Cursor ID
 
API_QT_CURSOR_
UPDATE
Yes *
Cursor ID
[parameter values]
IIAPI_GQ_TABLE_KEY or
IIAPI_GQ_OBJECT_KEY
API_QT_DEF_
REPEAT_QUERY
Yes *
[repeat query ID]
[repeat query parameters]
IIAPI_GQ_REPEAT_
QUERY_ID
API_QT_EXEC_
REPEAT_QUERY
No
Repeat query handle
[repeat query parameters]
 
API_QT_EXEC_
PROCEDURE
No
Procedure name or
procedure ID
[procedure owner]
[procedure parameters]
IIAPI_GQ_PROCEDURE_
ID

IIAPI_GQ_PROCEDURE_RET
API_QT_QUERY
Yes
[parameter values]
 
API_QT_SELECT_
SINGLETON
Yes
[parameter values]
 
* The query syntax for these statements differs from that used in embedded SQL. See SQL Syntax.
Last modified date: 08/28/2024