InterBase Status Array

From InterBase

Go Up to Error Reporting and Handling


Since each SQLCODE value can result from more than one type of error, the InterBase status array (isc_status) provides additional messages that enable further inquiry into SQLCODE errors.

gpre automatically declares isc_status, an array of twenty 32-bit integers, for all InterBase applications during preprocessing. When an error occurs, the status array is loaded with InterBase error codes, message string addresses, and sometimes other numeric, interpretive, platform-specific error data.

This chapter lists all status array codes in SQLCODE Error Codes and Messages. To see the codes online, display the ibase.h file. The location of this file is system-specific.

Access to Status Array Messages

InterBase provides the following library functions for retrieving and printing status array codes and messages.

isc_print_sqlerror( )

When SQLCODE < 0, this function prints the returned SQLCODE value, the corresponding SQL error message, and any additional InterBase error messages in the status array to the screen. Use within an error-handling routine.

isc_print_sqlerror (short SQLCODE, ISC_STATUS *status_vector);

isc_sql_interprete( )

This function retrieves a SQL error message and stores it in a user-supplied buffer for later printing, manipulation, or display. Allow a buffer length of 256 bytes to hold the message. Use when building error display routines or if you are using a windowing system that does not permit direct screen writes. Do not use this function when SQLCODE > 0.

isc_sql_interprete(short SQLCODE, char *buffer, short length);

Responding to Error Codes

After any error occurs, you have the following options: ignore the error, log the error and continue processing, roll back the transaction and try again, or roll back the transaction and quit the application.

For the following errors, it is recommended that you roll back the current transaction and try the operation again:

Status array codes that require rollback and retry
Status array code Action to take

isc_convert_error

Conversion error: A conversion between data types failed; correct the input and retry the operation.

isc_deadlock

Deadlock: Transaction conflicted with another transaction; wait and try again.

isc_integ_fail

Integrity check: Operation failed due to a trigger; examine the abort code, fix the error, and try again.

isc_lock_conflict

Lock conflict: Transaction unable to obtain the locks it needed; wait and try again.

isc_no_dup

Duplicate index entry: Attempt to add a duplicate field; correct field with duplicate and try again.

isc_not_valid

Validation error: Row did not pass validation test; correct invalid row and try again.

Advance To: