The fields of the locator structure

The locator structure has the following parts:
  • The loc_loctype field identifies the location of the simple-large-object data. It also indicates the variant type of the lc_union structure.

    For more information about loc_loctype, see Locations for simple-large-object data.

  • The lc_union structure is a union (overlapping variant structures) structure.

    The variant in use depends on where HCL OneDB ESQL/C can expect to find the simple large object at run time. For more information about this structure, see ids_esqlc_0203.html#ids_esqlc_0203 and Locate simple large objects in files.

  • Several fields are common to all types of simple-large-object variables.
The lists the fields in the locator structure common to all simple-large-object locations.
Table 1. Fields in locator structure common to all simple-large-object data locations
Field Data type Description
loc_indicator 4-byte integer A value of -1 in the loc_indicator field indicates a null simple-large-object value. The HCL OneDB ESQL/C program can set the field to indicate insertion of a null value; HCL OneDB ESQL/C libraries set it on a select or fetch.

For consistent behavior on various platforms, it is advised to set the value of the indicator to 0 or -1. If indicator is not set you can experience inconsistent behavior. The value set in the indicator field takes the higher precedence when set.

You can also use the loc_indicator field to indicate an error when your program selects into memory. If the simple large object to be retrieved does not fit in the space provided, the loc_indicator field contains the actual size of the simple large object.

loc_size 4-byte integer Contains the size of the simple-large-object data in bytes. This field indicates the amount of simple-large-object data that the HCL OneDB ESQL/C libraries read or write. The HCL OneDB ESQL/C program sets loc_size when it inserts a simple large object in the database; the HCL OneDB ESQL/C libraries set loc_size after it selects or fetches a simple large object.
loc_status mint Indicates the status of the last locator operation. The HCL OneDB ESQL/C libraries set loc_status to zero when a locator operation is successful and to a negative value when an error occurs. The SQLCODE variable also contains this status value.
loc_type 4-byte integer Specifies whether the data type of the variable is TEXT (SQLTEXT) or BYTE (SQLBYTES). The sqltypes.h header file defines SQLTEXT and SQLBYTES.