Entering content frame

 sqlvar [i] Entries in the Descriptor 

Each sqlvar [i] entry in the descriptor structure describes the properties of a parameter in the dynamic SQL statement, as well as the properties of the required or assigned program variables.

Each sqlvar [i] entry consists of the following components:

colname

Contains the name of the table column for a FETCH statement.

For all other SQL statements, colname contains the entry columnx, where x is a sequential number.

colio

Specifies whether the parameter is an input or output parameter.

sqlinppar: Input parameter
sqloutpar: Output parameter
sqlinoutpar: Input and output parameter

colmode

Specifies whether NULL values are permitted for the parameter.

colmode is a byte whose four low-order bits are interpreted as a bit mask.

Bit 0: Mandatory
Bit 1: Optional (NULL permitted)
Bit 2: Default
Bit 3: Escape Character

coltype

Specifies the MaxDB data type of the parameter.

See: MaxDB Data Types in sqlvar Entries

collength

Specifies the length of the parameter or table column.

For numerical data types, collength specifies the number of digits.

For all other data types, collength specifies the number of characters.

You can modify the value of collength, for example, if the closing NULL byte increases the number of characters in a character string by 1.

colfrac

Specifies the number of decimal places for numerical parameters or table columns.

For the data type FLOAT/REAL colfrac = -1.

hostindicator

Contains the indicator value, so performing the same task as an indicator variable.

For input parameters, the user can set hostindicator.

For output parameters, query hostindicator. If the table column contains a NULL value, the value of the program variable is not overwritten.

hostvartype

In hostvartype, specify the C/C++ data type of the program variable assigned to the parameter (see C/C++ Data Types in sqlvar Entries).

If necessary, modify the values of collength and colfrac.

The DESCRIBE statement initializes hostvartype with the value –1 (undefined).

hostcolsize

In hostcolsize, specify the size of an array element (in bytes) for array statements.

hostvaraddr

In hostvaraddr, specify the address of the program variable assigned to the parameter.

For array statements, specify the address of the first array element.

The DESCRIBE statement initializes hostvaraddr with the NULL value.

hostindaddr

Contains the address of hostindicator.

Instead of this, you can also specify the address of an indicator variable. The indicator value is then written to this variable, and the content of hostindicator is undefined.

For array statements, specify the address of the first array element of the indicator variable.

If you do not want to use an indicator value, specify NULL.

colinfo

Used for internal information on converting program variables.

Do not change this value.

 

 

Leaving content frame