Displaying InterBase Error Messages

From InterBase

Go Up to Using Information in the Status Vector


Use isc_print_status() to display InterBase error messages on the screen. This function parses the status vector to build all available error messages, then uses the C printf() function to write the messages to the display. isc_print_status() requires one parameter, a pointer to a status vector containing error information. For example, the following code fragment calls isc_print_status() and rolls back a transaction on error:

#include <ibase.h>
. . .
ISC_STATUS status_vector[20];
isc_tr_handle trans;
. . .
trans = 0L;
. . .
/* Assume a transaction, trans, is started here. */
/* Assume an API call returning status information is called here. */
if (status_vector[0] == 1 && status_vector[1] > 0) {
isc_print_status(status_vector);
isc_rollback_transaction(status_vector, &trans);
}
Important:
On windowing systems that do not permit direct screen writes with printf(), use isc_interprete() to capture error messages to a buffer.
Tip:
For applications that use the dynamic SQL (DSQL) API functions, errors should be displayed using SQL conventions. Use isc_sqlcode() and ­isc_print_sqlerror() instead of isc_print_status().

Advance To: