isc_sqlcode()

From InterBase

Go Up to API Function Reference


Translates an InterBase error code in the error status vector to a SQL error code number.

Syntax

 ISC_LONG isc_sqlcode (ISC_STATUS *status_vector);
Parameter Type Description

status_vector

ISC_STATUS *

Pointer to the error status vector

Description

isc_sqlcode() searches status_vector for a reported SQL error, and if it finds it, translates the InterBase error code number into an appropriate SQL error code. Typically, this call is used to populate a program variable (usually called SQLCODE for portability among SQL implementations) with a SQL error number for use in a SQL error-handling routine.

Example

The following code illustrates how isc_sqlcode() might be called in a DSQL application:

#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

If successful, isc_sqlcode() returns the first valid SQL error code decoded from the InterBase status vector.

If no valid SQL error code is found, isc_sqlcode() returns –999.

See Also

Advance To: