|
The mi_error_sqlcode() function retrieves the value of the Informix SQLCODE status variable from an error descriptor.
| err_desc | is a pointer to the error descriptor that describes an SQL error or warning. | |
| sqlcode_ptr | is a pointer to the SQLCODE value that mi_error_sqlcode() obtains from the err_desc error descriptor. | |
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
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().