isc_print_sqlerror()

From InterBase

Go Up to API Function Reference


Displays a SQLCODE value, a corresponding SQL error message, and any additional InterBase error messages in the error status vector.

Syntax

 void isc_print_sqlerror(
 short SQLCODE,
 ISC_STATUS *status_vector);
Parameter Type Description

SQLCODE

short

Variable containing a SQLCODE value.

status_vector

ISC_STATUS *

Pointer to the error status vector

Description

During the processing of DSQL API calls, SQL errors can occur. SQL errors are generally reported in a variable called SQLCODE. DSQL calls return error information to a user-defined error status vector like any other API call, but isc_print_sqlerror() can be used to interpret the primary error condition as a SQL error message for direct display on the screen. To use isc_print_sqlerror(), an application must declare both a SQLCODE variable for holding the SQL error number, and an error status vector for holding InterBase error information. isc_print_sqlerror() displays the SQLCODE value, a related SQL error message, and any additional InterBase error messages in the status array.

Note: Some windowing systems do not permit direct screen writes. Do not use isc_print_sqlerror() when developing applications for these environments. Instead, use isc_sql_interprete() and isc_interprete() to capture messages to a buffer for display.

Example

The following code calls isc_print_sqlerror() when an error occurs:

#include <ibase.h>
long SQLCODE;
ISC_STATUS status_vector[20];
. . .
if (status_vector[0] == 1 && status_vector[1]) {
SQLCODE = isc_sqlcode(status_vector);
isc_print_sqlerror(SQLCODE, status_vector);
}

Return value

None.

See Also

Advance To: