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
OneDB™ 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 (HCL OneDB RSAM status). This error code and message text are available through the mi_errmsg() and mi_error_sqlcode() functions.
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 HCL OneDB DataBlade® API Programmer's Guide.
Return values
None.