DB2 Version 9.7 for Linux, UNIX, and Windows

sqlopt data structure

This structure is used to pass bind options to the sqlabndx API, precompile options to the sqlaprep API, and rebind options to the sqlarbnd API.
Table 1. Fields in the SQLOPT Structure
Field Name Data Type Description
HEADER Structure An sqloptheader structure.
OPTION Array An array of sqloptions structures. The number of elements in this array is determined by the value of the allocated field of the header.
Table 2. Fields in the SQLOPTHEADER Structure
Field Name Data Type Description
ALLOCATED INTEGER Number of elements in the option array of the sqlopt structure.
USED INTEGER Number of elements in the option array of the sqlopt structure actually used. This is the number of option pairs (TYPE and VAL) supplied.
Table 3. Fields in the SQLOPTIONS Structure
Field Name Data Type Description
TYPE VAL

INTEGER

INTEGER

Bind/precompile/rebind option type.

Bind/precompile/rebind option value.

Note: The TYPE and VAL fields are repeated for each bind, precompile, or rebind option specified.

API and data structure syntax

SQL_STRUCTURE sqlopt
{
   SQL_STRUCTURE sqloptheader header;
   SQL_STRUCTURE sqloptions   option[1];
};

SQL_STRUCTURE sqloptheader
{
   sqluint32 allocated;
   sqluint32 used;
};

SQL_STRUCTURE sqloptions
{
   sqluint32 type;
   sqluintptr val;
};

COBOL Structure

* File: sql.cbl
01 SQLOPT.
    05 SQLOPTHEADER.
        10 ALLOCATED   PIC 9(9) COMP-5.
        10 USED        PIC 9(9) COMP-5.
    05 SQLOPTIONS OCCURS 1 TO 50 DEPENDING ON ALLOCATED.
        10 SQLOPT-TYPE        PIC 9(9) COMP-5.
        10 SQLOPT-VAL         PIC 9(9) COMP-5.
        10 SQLOPT-VAL-PTR     REDEFINES SQLOPT-VAL
*