Additional InterBase Error Handling

From InterBase

Go Up to Error Handling and Recovery


The same SQLCODE value can be returned by multiple InterBase errors. For example, the SQLCODE value, –901, is generated in response to many different InterBase errors. When portability to other vendors’ SQL implementations is not required, SQL programs can sometimes examine the InterBase error status array, isc_status, for more specific error information.

isc_status is an array of twenty elements of type ISC_STATUS. It is declared automatically for programs when they are preprocessed with gpre. Two kinds of InterBase error information are reported in the status array:

  • InterBase error message components.
  • InterBase error numbers.

As long as the current SQLCODE value is not –1, 0, or 100, error-handling routines that examine the error status array can do any of the following:

  • Display SQL and InterBase error messages.
  • Capture SQL and InterBase error messages to a storage buffer for further manipulation.
  • Trap for and respond to particular InterBase error codes.

The InterBase error status array is usually examined only after trapping errors with WHENEVER or testing SQLCODE directly.

Topics

Advance To: