IIapi_close() Function—End a Query Statement or Database Event Retrieval
The IIapi_close() function ends a query or database event retrieval started with IIapi_query(), IIapi_batch(), or IIapi_catchEvent(). This function frees the event or statement handle and closes any cursor associated with the statement handle.
An application calls IIapi_close() to end a query that has finished all OpenAPI function calls required by the query type. The application must call IIapi_cancel() to interrupt a query with outstanding requests prior to calling IIapi_close().
IIapi_close() invalidates any data returned by the IIapi_catchEvent(), IIapi_getCopyMap(), IIapi_getDescriptor(), or IIapi_getErrorInfo() functions for the statement handle.
For each IIapi_query(), IIapi_batch(), or IIapi_catchEvent(with NULL ce_eventHandle), there should be a corresponding IIapi_close().
The following are possible results of the IIapi_close() function and their corresponding actions:
• Completes with status IIAPI_ST_FAILURE and error code E_AP0006_INVALID_SEQUENCE-IIapi_close() has already been called for the statement handle and this call is ignored.
• Completes with status IIAPI_ST_FAILURE and error code E_AP0007_INCOMPLETE_QUERY-OpenAPI query processing of the statement handle has not completed. Query must be canceled using IIapi_cancel().
• Competes with status IIAPI_ST_FAILURE and error code E_AP000A_QUERY_INTERRUPTED-IIapi_cancel() has been called on the statement handle but the server has not yet canceled the query. There is an outstanding OpenAPI request that will complete with status IIAPI_ST_FAILURE and error code E_AP0009_QUERY_CANCELLED, after which the statement handle can be closed using IIapi_close().
This function has the following syntax:
II_VOID IIapi_close (IIAPI_CLOSEPARM *closeParm);
typedef struct _IIAPI_CLOSEPARM
{
IIAPI_GENPARM cl_genParm;
II_PTR cl_stmtHandle;
} IIAPI_CLOSEPARM;
This function has the following parameters:
cl_genParm
Type: input and delayed output
cl_stmtHandle
Type: input
Specifies the statement or event handle identifying the query or event retrieval for which resources should be freed.