Non-ASCII characters in host variables

HCL OneDB™ ESQL/C allows the use of non-ASCII characters in host variables when certain conditions are true.

The following conditions must be true to allow the use of non-ASCII characters:
  • The client locale supports a code set with the non-ASCII characters that the host-variable name contains. You must set the client locale correctly before you preprocess and compile the HCL OneDB ESQL/C program. For more information, see Set a GLS locale.
  • Your C compiler supports compilation of the same non-ASCII characters as the source code.

    You must ensure that the C compiler supports use of non-ASCII characters in C source code. For information about how to indicate the support that your C compiler provides for non-ASCII characters, see Invoke the ESQL/C filter.

HCL OneDB ESQL/C applications can also support non-ASCII characters in comments and SQL identifiers. For more information, see Non-ASCII characters in identifiers.

The following code fragment declares an integer host-variable that contains a non-ASCII character in the host-variable name and then selects a serial value into this variable:
/*
   This code fragment declares an integer host variable
   "hte_ent", which contains a non-ASCII character in the
   name, and selects a serial value (code number in the
   "numro" column of the "abonns" table) into it.
*/

EXEC SQL BEGIN DECLARE SECTION;
   int hte_ent;
...
   
   
EXEC SQL END DECLARE SECTION;
...


EXEC SQL select numro into :hte_ent from abonns
   where nom = 'tker';
If the client locale supports the non-ASCII characters, you can use these characters to define indicator variables, as the following example shows:
EXEC SQL BEGIN DECLARE SECTION;
   char   htevar[30];
   short  ind_de_htevar;
EXEC SQL END DECLARE SECTION;
You can then access indicator variables with these non-ASCII names, as the following example shows:
:htevar INDICATOR :htevarind

:htevar   :htevar   ind

$htevar      $htevar   ind