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

Locale-Sensitive Data in an Opaque Data Type

An opaque data type is fully encapsulated. Its internal structure is not known to the database server. The database server cannot automatically perform the locale-specific tasks such as code-set conversion on character data or locale-specific formatting of date, numeric, or monetary data. When you create an opaque data type, you must write the support functions of the opaque type so that they handle any locale-sensitive data.

In particular, consider how to handle any locale-sensitive data when you write the following support functions:

The DataBlade API and IBM Informix GLS provide GLS support for opaque-type support functions written in C. The following sections summarize GLS considerations for these support functions. For general information on the support functions of an opaque data type, see IIBM Informix: User-Defined Routines and Data Types Developer's Guide.

Internationalized Input and Output Support Functions

The internal representation of an opaque data type is the C structure that stores the opaque-type data. Each opaque type also has a character-based format, known as its external representation, which is received by the database server as an LVARCHAR value. This can hold single-byte (ASCII and non-ASCII) and multibyte character strings, depending on the locale of the client application. (The data length of an LVARCHAR external representation is limited only by the operating system, not by the 32,739 byte maximum size of LVARCHAR columns in Dynamic Server databases.)

Client applications perform code-set conversion on LVARCHAR data types. The ability to transfer the data between a client application and database server, however, is not sufficient to support locale-sensitive data in opaque data types. It does not ensure that data values are correctly manipulated at the destination.

The input( ) and output( ) support functions convert the opaque data type from its internal to an external representation, and vice versa, as follows:

Opaque-type support functions written as C UDRs must ensure that these functions correctly handle any locale-sensitive data, including these tasks.

Locale-Sensitive Task For More Information
Any code-set conversion on character data Code-Set Conversion and the DataBlade API
Any handling of multibyte or wide characters in character data The IBM Informix GLS Library
Any formatting of locale-specific date, numeric, or monetary data Locale-Specific Data Formatting

Internationalized Send and Receive Support Functions

The send( ) and receive( ) functions support binary transfer of opaque data types. That is, they convert the opaque data type from its internal representation on the client computer to its internal representation on the server computer (where it is stored), as follows:

If the internal representation contains character data, the client application cannot perform any locale-specific translations, including these.

Locale-Sensitive Task For More Information
Any code-set conversion on character data Character Strings in Opaque-Type Support Functions
Any handling of multibyte or wide characters in character data The IBM Informix GLS Library

When you write receive( ) and send( ) support functions as C UDRs, you must ensure that these functions handle these locale-sensitive tasks correctly.

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