Defining custom localization values for a connection

Table 3-3 describes how to define custom localization values at the connection level.

Table 3-3: Installing custom values at the connection level

Step

Application step

Purpose

Details

1

Call cs_loc_alloc.

Allocate a CS_LOCALE structure.

This call copies the parent context’s current localization information into the CS_LOCALE structure.

2

Call cs_locale.

Overwrite the CS_LOCALE structure with custom localization values.

For more information about this process, see “The cs_locale routine”.

3

Optionally, call cs_dt_info.

Change datetime conversion formats in the CS_LOCALE structure.

For more information about cs_dt_info, see the Open Client and Open Server Common Libraries Reference Manual.

4

Call ct_con_props with property as CS_LOC_PROP.

Customize a connection.

Note that CS_LOC_PROP is a login property. An application cannot change its value after a connection is open.

If an application sends a request to the server to change the language or character for the connection after the connection is open, the change will not be reflected in the value of CS_LOC_PROP. If the application calls ct_con_props to retrieve the value of CS_LOC_PROP, the retrieved locale structure will not contain the connection’s current localization values.

5

Optionally, call cs_loc_drop.

Deallocate the CS_LOCALE structure.

An application can reuse the CS_LOCALE structure before deallocating it.

If necessary, the application can call cs_locale to change the localization values in the structure before reusing it.

When a client application calls ct_connect to open a connection, the server determines whether it can support the requested localization. If it can, it accepts the connection as is. If it cannot, it forces the connection to an alternate language and/or character set. At this point, the client may either accept or reject the altered connection.