DB2 10.5 for Linux, UNIX, and Windows

Declaration of large object locator type host variables in C and C++ embedded SQL applications

Large object (LOB) locator 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 large object (LOB) locator host variables in C or C++ is:

Read syntax diagramSkip visual syntax diagram
>>-+----------+--+----------+--SQL TYPE IS---------------------->
   +-auto-----+  +-const----+                
   +-extern---+  '-volatile-'                
   +-static---+                              
   '-register-'                              

                       .-,----------------.      
                       V                  |      
>--+-BLOB_LOCATOR---+----+--------------+-+--;-----------------><
   +-CLOB_LOCATOR---+    '-| Variable |-'        
   '-DBCLOB_LOCATOR-'                            

Variable

   .---------------------.                                    
   V                     |                                    
|----+-*-+--+----------+-+--variable-name--+--------------+-----|
     '-&-'  +-const----+                   '-= init-value-'   
            '-volatile-'                                      

LOB locator host variable considerations:
  1. SQL TYPE IS, BLOB_LOCATOR, CLOB_LOCATOR, DBCLOB_LOCATOR can be in mixed case.
  2. init-value permits the initialization of pointer and reference locator variables. Other types of initialization will have no meaning.

CLOB locator example (other LOB locator type declarations are similar):

Declaration:
  SQL TYPE IS CLOB_LOCATOR my_locator;
Results in the generation of the following declaration:
  sqluint32 my_locator;