Declaration of GRAPHIC type host variables in single-graphic and null-terminated graphic forms in C and C++ embedded SQL applications

Single and null-terminated GRAPHIC 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.

Following is the syntax for declaring a graphic host variable using the single-graphic form and the null-terminated graphic form.

Read syntax diagramSkip visual syntax diagramautoexternstaticregisterconstvolatile1sqldbcharwchar_t,CHARC string=value
CHAR
Read syntax diagramSkip visual syntax diagram*&constvolatilevarname2
C string
Read syntax diagramSkip visual syntax diagramvarname(*&constvolatilevarname)[length]3
Read syntax diagramSkip visual syntax diagram;
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 GRAPHIC (SQLTYPE 468), length 1
  • 3 Null-terminated graphic string (SQLTYPE 400)
Graphic host variable considerations:
  1. The single-graphic form declares a fixed-length graphic string host variable of length 1 with SQLTYPE of 468 or 469.
  2. value is an initializer. A wide-character string literal (L-literal) must be used if the WCHARTYPE CONVERT precompiler option is used.
  3. length can be any valid constant expression, and its value after evaluation must be greater than or equal to 1, and not greater than the maximum length of VARGRAPHIC, which is 16 336.
  4. Null-terminated graphic strings are handled differently, depending on the value of the standards level precompile option setting.