Home | Previous Page | Next Page   Database Server Features > Locale Support For C User-Defined Routines (IDS and DB API) >

Code-Set Conversion and the DataBlade API

Within a UDR, the DataBlade API does not perform any code-set conversion automatically. Your C UDR might need to perform code-set conversion in the following situations:

Character Strings in UDRs

When your C UDR contains character strings that are sent to the database server, it must perform any required code-set conversion on these strings. This code-set conversion must handle any differences between the code set of this character string and the code set of the server-processing locale in which the UDR executes.

For example, the DataBlade API does not perform code-set conversion on the multibyte table name, A1A2A3B1B2, in the following SELECT statement:

mi_exec(conn, "SELECT * from A1A2A3B1B2", 0);

If your UDR might execute in a server-processing locale that does not include a code set that supports characters in your SQL statements, the UDR can explicitly perform code-set conversion between the code sets of the server-processing locale and a specified locale.

The DataBlade API provides the following functions to assist in this code-set conversion.

Code-Set Conversion on a String DataBlade API Function
Perform code-set conversion on a specified string from a specified locale to the server-processing locale mi_convert_from_codeset( )
Perform code-set conversion on a specified string from the server-processing locale to a specified locale mi_convert_to_codeset( )

For more information on the syntax of these DataBlade API functions, see the function reference of the IBM Informix: DataBlade API Programmer's Guide.

Character Strings in Opaque-Type Support Functions

The client application performs code-set conversion of non-opaque-type data that is transferred to and from the client, but the database server does not know about the internal format of an opaque data type. Therefore, for opaque data types, the support functions are responsible for explicitly converting any string that is not in the code set of the server-processing locale.

You might need to perform code-set conversion in the following opaque-type support functions:

Tip:
The code that the DataBlade Developer's Kit (DBDK) generates for opaque-type input and output support functions handles external formats from nondefault locales.

The DataBlade API provides the following functions for code-set conversion in the support functions of an opaque data type.

Code-Set Conversion on an Opaque Type DataBlade API Function
Perform code-set conversion on a string argument from the code set of the server-processing locale to that of the client locale mi_put_string( )
Perform code-set conversion on a string from the code set of the client locale to that of the server-processing locale mi_get_string( )

For more information on the syntax of these DataBlade API functions, see the function reference in the IBM Informix: DataBlade API Programmer's Guide.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]