Format a locale-specific string

The formatting functions scan the incoming locale-specific string to create a corresponding internal representation, as shown in the following table..
Table 1. Formatting functions for locale-specific strings

Formatting functions for locale-specific strings

Formatting function Unformatted form: ESQL/C internal representation Unformatted form: DataBlade® API internal representation Formatted form
ifx_gl_format_number() decimal (dec_t) mi_decimal Number string
ifx_gl_format_money() decimal (dec_t) mi_decimal Money string
ifx_gl_format_date() date (long int) mi_date Date string
ifx_gl_format_datetime() datetime (dtime_t) mi_datetime Date/time string

The formatting directives in the format string tell the formatting functions how to format the internal representation of a value into a locale-specific string. To process a formatting directive, a formatting function consults the appropriate category in the current locale to obtain any locale-specific formats and then formats the locale-specific string with this information.

For example, the following DataBlade API call to the function ifx_gl_format_number() converts the hexadecimal representation of the number 1450 to a number string:
mi_decimal num_val;
char num_str[BUFSIZE];
...
if ( ifx_gl_format_number(num_str, BUFSIZE, &num_val,"%0x") != 0 )
    /* handle error */ 

If the current locale is the default locale, num_str contains the number string "1,450" upon successful completion of this call to ifx_gl_format_number(). The function correctly formats the comma (,) as the thousands separator in the number string.