How Batch Statements without Parameters Are Executed
A set of n statements may be executed as a batch by calling IIapi_batch() n times, once for each statement in the batch. For the first statement in the batch, the statement handle passed to IIapi_batch() is set to NULL and a new statement handle is returned after the call to IIapi_batch(). The returned statement handle is used for all subsequent calls associated with the batch.
After the last statement in the batch is submitted, the statement execution results may be retrieved by calling IIapi_getQueryInfo(). In general, IIapi_getQueryInfo() should be called once for each query in the batch. The results for each query in the batch will be returned in the order the statements were submitted for execution:
IIapi_getQueryInfo() returns one of the following statuses to indicate the status of the associated statement executed in the batch:
• IIAPI_ST_SUCCESS
• IIAPI_ST_MESSAGE
• IIAPI_ST_WARNING
• IIAPI_ST_ERROR
Errors caused by how the application calls IIapi_getQueryInfo() are indicated by a status of:
• IIAPI_ST_FAILURE
• IIAPI_ST_NOT_INITIALIZED
• IIAPI_ST_INVALID_HANDLE
• IIAPI_ST_OUT_OF_MEMORY
Certain errors during batch processing may result in fewer results being returned than the number of statements contained in the batch. When this occurs, IIapi_getQueryInfo() returns a status of IIAPI_ST_NO_DATA after all the available results are returned. Even if a critical error does not occur, IIapi_getQueryInfo() returns a status of IIAPI_ST_NO_DATA after the results for all statements in the batch are returned.