Parameter diagnostic information in CLI applications

A parameter status array is an array of one or more SQLSMALLINT data type elements that is allocated by a CLI application. Each element in the array corresponds to an element in the input or output parameter array.

If specified, the CLI driver updates the parameter status array with information about the processing status of each set of parameters included in an SQLExecute() or SQLExecDirect() call.

CLI updates the elements in the parameter status array with the following values:
  • SQL_PARAM_SUCCESS: The SQL statement was successfully executed for this set of parameters.
  • SQL_PARAM_SUCCESS_WITH_INFO: The SQL statement was successfully executed for this set of parameters, however, warning information is available in the diagnostics data structure.
  • SQL_PARAM_ERROR: An error occurred in processing this set of parameters. Additional error information is available in the diagnostics data structure.
  • SQL_PARAM_UNUSED: This parameter set was unused, possibly because a previous parameter set caused an error that aborted further processing.
  • SQL_PARAM_DIAG_UNAVAILABLE: Diagnostic information is not available, possibly because an error was detected before the parameter set was even used (for example, an SQL statement syntax error).

A CLI application must call the SQLSetStmtAttr() function to set the SQL_ATTR_PARAM_STATUS_PTR attribute before CLI will update the parameter status array. Alternatively, the application can call the SQLSetDescField() function to set the SQL_DESC_ARRAY_STATUS_PTR field in the IPD descriptor to point to the parameter status array.

The statement attribute SQL_ATTR_PARAMS_PROCESSED, or the corresponding IPD descriptor header field SQL_DESC_ROWS_PROCESSED_PTR, can be used to return the number of sets of parameters that have been processed.

Once the application has determined what parameters had errors, it can use the statement attribute SQL_ATTR_PARAM_OPERATION_PTR, or the corresponding APD descriptor header field SQL_DESC_ARRAY_STATUS_PTR, (both of which point to an array of values) to control which sets of parameters are ignored in a second call to SQLExecute() or SQLExecDirect().