InterBase Status Array
Go Up to Error Reporting and Handling
Contents
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 code | Action to take |
---|---|
|
Conversion error: A conversion between data types failed; correct the input and retry the operation. |
|
Deadlock: Transaction conflicted with another transaction; wait and try again. |
|
Integrity check: Operation failed due to a trigger; examine the abort code, fix the error, and try again. |
|
Lock conflict: Transaction unable to obtain the locks it needed; wait and try again. |
|
Duplicate index entry: Attempt to add a duplicate field; correct field with duplicate and try again. |
|
Validation error: Row did not pass validation test; correct invalid row and try again. |