The mi_errmsg() function

The mi_errmsg() function retrieves an error or warning message from an error descriptor into a user-allocated buffer.

Syntax

void mi_errmsg(err_desc, msgbuf, msgbuflen)
   MI_ERROR_DESC *err_desc;
   char *msgbuf;
   mi_integer msgbuflen;
err_desc
A pointer to the error descriptor that describes the exception.
msgbuf
A pointer to a user-allocated buffer to contain the message.
mgsbuflen
The length of the msgbuf buffer.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_errmsg() function copies the text of an error or warning message from the error descriptor that err_desc references into the user-allocated buffer that msgbuf references. You must ensure that both msgbuflen and msgbuf are large enough to accommodate any error or warning text that the error descriptor might hold. If the buffer is too small, mi_errmsg() truncates the message. System-generated messages, especially those that contain path names, can be quite long. A good starting value for buflen is usually 256.

The mi_errmsg() function always terminates the message with a null terminator, provided msgbuflen is greater than 0. Message text that mi_errmsg() retrieves for database server exceptions is the most specific text, that is, the text associated with the HCL Informix® SQLCODE value. The mi_errmsg() function does not retrieve any ANSI or X/Open message text.

A separate, additional callback follows the callback for the SQLCODE value when an exception has an access-method error code (Informix® RSAM status). This error code and message text are available through the mi_errmsg() and mi_error_sqlcode() functions.

Server only: For a C UDR, mi_errmsg() does not prefix the message text with the error number.
Client only: For a client LIBMI application, mi_errmsg() adds error codes to the start of the message.

The mi_errmsg() function is useful in an exception callback for getting the error or warning message associated with an exception.

For general information about how to obtain information from an error descriptor, see the Informix® DataBlade® API Programmer's Guide.

Return values

None.