Home | Previous Page | Next Page   Writing Support Functions >

Handling Locale-Sensitive Data (GLS)

An Informix database has a fixed locale per database. This locale, the database locale, is attached to the database at the time that the database is created. In any given database, all character data types (such as CHAR, NCHAR, VARCHAR, NVARCHAR, and TEXT) contain data in the code set that the database locale supports.

However, using the SQL statement SET COLLATION you can specify the collation order to use at runtime, which is independent of the locale used to store data in the database, and lasts for the duration of the session. You can use the mi_get_db_locale() function to determine which locale a user has set for the collation order in a session. If the user has not changed the collation, mi_get_db_locale() returns the default database locale. See the IBM Informix: Guide to SQL Syntax for information about the SET COLLATION statement. See the IBM Informix: DataBlade API Function Reference for information about the mi_get_db_locale() function.

An opaque data type can hold character data. The following support functions provide the ability to transfer opaque-type data between a client application and the database server:

However, the ability to transfer the data between client application and database server is not sufficient to support locale-sensitive data. It does not ensure that the data is correctly manipulated at each end. You must ensure that both sides of the connection handle the locale-sensitive data, as follows:

For more information on the CLIENT_LOCALE, DB_LOCALE, and SERVER_LOCALE environment variables, see the IBM Informix: GLS User's Guide.

To help you write support functions that handle locale-sensitive data, the IBM Informix GLS API is provided. The GLS API is a thread-safe library. This library contains C functions that allow your support functions to obtain locale-specific information from GLS locales, including:

For an overview of the GLS API, see the IBM Informix: GLS User's Guide. For a description of the GLS API functions, see the IBM Informix: GLS Programmer's Manual.

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