2. Embedded SQL for C : C Variables and Data Types : Variable Usage : Simple Variables
 
Share this page                  
Simple Variables
The following syntax refers to a simple scalar-valued variable (integer, floating-point or character string):
:simplename
Syntax Notes:
If you use the variable to send values to the database, or a field on a form, it can be any scalar-valued variable or # define constant, enumerated variable or enumerated literal.
If you use the variable to receive values from the database or a field on a form, it can only be a scalar-valued variable or enumerated variable. Character strings that you declare as:
char *character_string_pointer;
or:
char character_string_buffer[];
are considered scalar-valued variables and must not include any indirection when referenced. External compiled forms that are declared as:
extern int *compiled_formname; (UNIX)
globalref int *compiled_formname; (VMS)
should not include any indirection when referenced in the addform statement:
exec frs addform :compiled_formname;
The following program fragment demonstrates a typical message handling routine. It passes two scalar-valued variables as parameters: "buffer", a character string, and "seconds", an integer variable.
Example: Simple variables usage
Print_Message(buffer, seconds)
 exec sql begin declare section;
       char *buffer;
       short seconds;
 exec sql end declare section;
 {
       exec frs message :buffer;
       exec frs sleep :seconds;
       ...
 }
Note:  Ingres supports Unicode using Unicode Transformation Format 16 (UTF‑16), representing Unicode code points in 16 bits (two octets). Embedded C for Ingres allows for variables of the C data type wchar_t to contain Ingres Unicode data. The C Standard does not specify a size for the wchar_t data type, however, if the compilation platform uses at least 16 bits for the data type wchar_t, it can be used for Ingres embedded C programs. When Ingres updates variables of the type wchar_t, only the low 16 bits are used; any extra high bits are set to zero. When Ingres reads values from wchar_t variables, only the low 16 bits are used and any extra high bits are ignored.