DataBlade module routines can print error messages and trace messages. Error messages are printed with the mi_db_error_raise() function. Trace messages are written to a trace file with the DBDK_TRACE macros or the gl_dprintf() macro. See Tracing and Error Handling for more information on tracing and error handling.
Although it is possible to hard-code messages in your routines, defining them in BladeSmith makes them easier to edit. Also, BladeSmith generates code that uses the IBM Informix Global Language Support (GLS) API, so messages that you create in BladeSmith can be easily localized.
The following table lists the properties you specify when you create an error.
Property | Default Value | Description |
---|---|---|
SQL error code | None | A five-character error code. This character string
uniquely identifies the error or trace message.
See SQL Error Code for more information. |
Error locale | The locale of your Windows installation | An Informix locale specification for the message.
See Error Locale for more information. |
Register message as error, trace, or both? | Error | Error messages are added to the syserrors system table. Trace messages are added to the systracemsgs system table. If you choose Both, the message is added to both system tables. |
SQL error text | None | A character string that can contain embedded
parameters to be replaced with current values at runtime.
See SQL Error Text for more information. |
The following sections describe properties of errors.
To ensure that your error codes do not conflict with built-in error codes and those of other DataBlade modules, consider qualifying the code with a three-character DataBlade module prefix such as USR.
See Developing Your DataBlade Module for information on how to design your error codes.
The error locale enables the database server to select a translated error or trace message for a localized database. The locale is specified using the format language_country.codeset. Be sure to create messages for all of the locales in which your DataBlade module executes.
The default BladeSmith locale, en_us.8859-1, is for U.S. English using code set 8859. This is the default locale for the Informix database server on UNIX platforms.
The default code set for the Informix database server on Windows is 1252. Create U.S. English messages using locale en_us.1252 for Windows database servers.
For more information on locales, see the IBM Informix: GLS User's Guide.
The SQL error text is displayed with the error code in the language specified by the message locale. To specify parameters in messages, assign each parameter a unique name enclosed in percent characters (%). For example, an input function could send the following message when it is unable to translate an input value:
%FUNCNAME%: Unable to decipher input '%INPUT%'.
For information about tracing and calling error messages, see the IBM Informix: DataBlade API Programmer's Guide.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]