informix
Informix DataBlade API Programmer's Manual
DataBlade API Function Descriptions

mi_error_sqlcode()

The mi_error_sqlcode() function retrieves the value of the Informix SQLCODE status variable from an error descriptor.

Syntax

Usage

The mi_error_sqlcode() function copies the value of the Informix SQLCODE status variable from the error descriptor that err_desc references into the user-allocated variable that sqlcode_ptr references. The SQLCODE variable contains an Informix-specific integer value that is 0 to indicate success and negative to indicate an error.

This function is intended for use with the MI_ERROR_DESC structure passed to a callback routine when the callback exception is of type MI_Exception. You can use the mi_error_sqlcode() function to retrieve an SQLCODE value to provide more information about cases in which SQLSTATE indicates an Informix-specific error ("IX000 " value).

Important: The mi_error_sqlcode() function is different from the Illustra mi_error_sql_code() function, which returns the SQLSTATE value rather than the SQLCODE value.

If no SQLCODE value is defined, as for mi_db_error_raise() exceptions, mi_error_sqlcode() sets sqlcode_ptr to 0.

Tip: The SQLSTATE variable is an ANSI-complaint way to indicate errors. The SQLCODE variable is specific to Informix. If your application is to be ANSI compliant, use SQLSTATE rather than SQLCODE.

Return Values

MI_OK indicates that the function was successful.
MI_ERROR indicates that the function was not successful.

Related Topics

See the descriptions of the following functions: mi_errmsg(), mi_error_desc_copy(), mi_error_desc_is_copy(), mi_error_desc_destroy(), mi_error_level(), and mi_error_sql_state().


Informix DataBlade API Programmer's Manual, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved