Access the locator structure
In the program, you use a locator structure to access simple-large-object values.
The locator structure is the host variable for TEXT and BYTE columns
when they are stored in or retrieved from the database. This structure
describes the location of a simple-large-object value for the following
two database operations:
- When the program inserts the simple large object into the database,
the locator structure identifies the source of the simple-large-object
data to insert. It is recommended that you initialize the data structure before using it, as in the following example:
byfill(&blob1, sizeof(loc_t), 0); where blob1 is declared as -- EXEC SQL BEGIN DECLARE SECTION; loc_t blob1; EXEC SQL END DECLARE SECTION;
This ensures that all variables of the data structure have been initialized and will avoid inconsistencies
- When the program selects the simple large object from the database, the locator structure identifies the destination of the simple-large-object data.
The locator.h header file defines the locator
structure, called loc_t. The following figure shows the definition
of the loc_t locator structure from the locator.h file.
In Declaration
of loc_t in the locator.h header file, the following
comments in the locator.h file indicate how the
fields are used in the locator structure.
- USER
- The program sets the field, and the libraries inspect the field.
- SYSTEM
- The libraries set the field, and the program inspects the field.
- INTERNAL
- The field is a work area for the libraries, and the program does not need to examine the field.
does
not automatically include the locator.h header
file in the program.
You must include the locator.h header file in
any program
that defines simple-large-object variables.
EXEC SQL include locator;