SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Dynamic SQL Rowsets
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
12-10
Using the DESCRIBE INPUT Statement
For the full description of the GET DESCRIPTOR Statement, including the other-
descriptor-item-names, see the SQL/MX Reference Manual. The variable-
name must be a host variable with exact numeric data type.
Using the DESCRIBE INPUT Statement
Use the DESCRIBE INPUT statement after PREPARE to fill rowset-specific descriptor
fields with appropriate values. This strategy frees you from setting these descriptor
fields manually before execution. However, because DESCRIBE INPUT records
compile-time information only, you must manually set descriptor fields if the value
provided by DESCRIBE is not appropriate for the execution-time environment in the
application.
For the ROWSET_SIZE descriptor header field, DESCRIBE INPUT sets the value of
this field to N, the common size of all input rowset parameters in the SQL statement.
This field is set to N even if there are multiple scalar parameters in the SQL statement
and only one rowset parameter for input exists. If no rowset parameters for input exist,
this field is set to zero by DESCRIBE INPUT.
For the ROWSET_VAR_LAYOUT_SIZE descriptor item field, DESCRIBE INPUT sets
its value to the value of OCTET_LENGTH + NT, where OCTET_LENGTH is an item
descriptor field, as defined in the SQL/MX Reference Manual, if an rowset parameter is
specified for input or to zero otherwise.
The variable NT is defined as the size of the null terminator:
•
NT is zero for all numeric data types except DECIMAL.
•
NT is one for all fixed-length character data types and ANSI VARCHAR, DATE,
TIME, TIMESTAMP, and INTERVAL data types if a single-byte character set is
used.
•
NT is two for all fixed-length character data types and ANSI varchar if a double-
byte character set is used. For the SQL/MX extension TYPE -601 (character
varying with length specified in the first two bytes), NT equals zero. Note that for
this type, the value specified by DESCRIBE for ROWSET_VAR_LAYOUT_SIZE does
not include the two bytes used for length specification.
If the individual array element size of the rowset host variable used is of a different
size, the value provided by DESCRIBE INPUT must be overwritten.
For the ROWSET_IND_LAYOUT_SIZE descriptor item field, DESCRIBE INPUT sets
the value of this field to two, if an rowset parameter was specified for input, or to zero,
otherwise. If indicator data is provided in a type other than signed short, then the value
provided by DESCRIBE INPUT must be overwritten.
DESCRIBE OUTPUT does not provide information on rowset-specific descriptor fields.
If rowsets are used for output, the value provided by DESCRIBE OUTPUT must be
overwritten.