Initialize the library

Before you can use functions in your application, these functions must be able to access the current processing locale.

The ifx_gl_init() function initializes the current processing locale to the client locale. It creates a global locale structure that the functions can access to obtain the name of the current processing locale.

Whether an application requires a call to the ifx_gl_init() function depends on whether the application establishes its own connection to a database server or executes in the context of an existing database server connection:
  • ESQL/C applications establish their own connections to a database server and therefore must call the ifx_gl_init() function at the beginning of the main() program block to establish the client locale as the current processing locale.
  • DataBlade® client applications establish their own connections to a database server and therefore must call the ifx_gl_init() function at the beginning of the main() program block to establish the client locale as the current processing locale.
  • DataBlade user-defined routines (UDRs) execute in the context of an established connection and therefore use the server-processing locale as their current processing locale.

    The database server uses a server-processing locale to obtain locale information for its own internal sessions and for any connections. It uses the values of the client locale, database locale, server locale, and other environment information to determine the server-processing locale. DataBlade UDRs are not required to call the ifx_gl_init() function. For more information about the server-processing locale and how the database server establishes it, see the Informix® GLS User's Guide.

Important: You must ensure that the database server has established a current processing locale for an application before the application uses any other functions. If an application requires the ifx_gl_init() function, it must call ifx_gl_init() before it calls any other functions.

The ifx_gl_init() function does not generate an error if you call it multiple times within the same application. The first time that the application calls ifx_gl_init(), the function initializes the global locale structure. Subsequent calls do not result in multiple locale structures.