Declaration of VARGRAPHIC type host variables in the structured form in C or C++ embedded SQL applications

VARGRAPHIC type host variables that you declare in your embedded C or C++ application are treated as if they were declared in a C or C++ program. You can use host variables to exchange data between the embedded application and the database manager.

The following is the syntax for declaring a graphic host variable using the VARGRAPHIC structured form.

Read syntax diagramSkip visual syntax diagramautoexternstaticregisterconstvolatilestructtag {shortint var-1; 1sqldbcharwchar_t var-2 [length2] ;},*&constvolatileVariable;
Variable
Read syntax diagramSkip visual syntax diagramvariable-name={value-1,value-2}
Notes:
  • 1 To determine which of the two graphic types to be used, see the description of the wchar_t and sqldbchar data types in C and C++.
  • 2 length can be any valid constant expression. Its value after evaluation determines if the host variable is VARGRAPHIC (SQLTYPE 464) or LONG VARGRAPHIC (SQLTYPE 472). The value of length must be greater than or equal to 1, and not greater than the maximum length of LONG VARGRAPHIC which is 16 350.
Graphic declaration (VARGRAPHIC structured form) Considerations:
  1. var-1 and var-2 must be simple variable references (no operators) and cannot be used as host variables.
  2. value-1 and value-2 are initializers for var-1 and var-2. value-1 must be an integer and value-2 must be a wide-character string literal (L-literal) if the WCHARTYPE CONVERT precompiler option is used.
  3. The struct tag can be used to define other data areas, but itself cannot be used as a host variable.