Declaration of file reference type host variables in C and C++ embedded SQL applications

File reference 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 syntax for declaring file reference host variables in C or C++ is:

Figure 1. Syntax Diagram

Syntax for file reference host variables in C or C++

Read syntax diagramSkip visual syntax diagramautoexternstaticregisterconstvolatileSQL TYPE IS?XML ASBLOB_FILECLOB_FILEDBCLOB_FILE,Variable
Variable
Read syntax diagramSkip visual syntax diagram*&constvolatilevariable-name= init-value
Read syntax diagramSkip visual syntax diagram;
Note: SQL TYPE IS, BLOB_FILE, CLOB_FILE, DBCLOB_FILE can be in mixed case.

CLOB file reference example (other LOB file reference type declarations are similar):

Declaration:
   static volatile SQL TYPE IS BLOB_FILE my_file;
Results in the generation of the following structure:
   static volatile struct { 
        sqluint32        name_length; 
        sqluint32        data_length; 
        sqluint32        file_options; 
                 char    name[255]; 
   } my_file;
Note: This structure is equivalent to the sqlfile structure located in the sql.h header. See Figure 1 to refer to the syntax diagram.