SQL Programming Manual for Pascal

Error and Status Processing
HP NonStop SQL Programming Manual for Pascal528614-001
6-18
Guidelines for Declaring the SQLDA
Guidelines for Declaring the SQLDA
In an SQLDA structure for NonStop Release 1, the flag R1 is appended to the
SQLDA_EYE_CATCHER literal declaration (SQLDA_EYE_CATCHER_R1).
If you do not know how many output values or input parameter values you will use,
either specify arbitrary numbers or use dynamic memory allocation to allocate
space for input parameters and output variables as they become known to the
program.
When you issue the INCLUDE SQLDA directive, supply a place-holder value for
the parameters or columns and the names buffer length. Then allocate memory as
needed. For an example, see the detailed dynamic SQL program in Appendix C.
Indicator variable names appear in the names buffer. If the names are short, the
INCLUDE SQLDA directive generates sufficient space for them; however, if the
names are long and you use many indicator variables, then explicitly allocate the
names buffer separately from the INCLUDE SQLDA statement. For an example,
see the detailed dynamic SQL program in Appendix C.
Data Type Literals
Use the literal declarations provided in the PEXTDECS file for the
SQLDA_DATA_TYPE and PRECISION fields. To include these declarations in your
program, use the SOURCE directive. For example:
?SOURCE $ VOL. SUBVOL.PEXTDECS
fraction_precision* Fraction precision for a date-time or INTERVAL column.
null_info* For input parameters, contains a negative integer if the
column could contain a null value. (To verify whether a
column is null, check the ind_ptr field for a negative value.)
For output columns, contains a negative integer if the row
returned is null.
var_ptr Extended address of the actual data (the value of the input
parameter or database column). The extended address is not
returned by SQL; your program must initialize var_ptr to point
to the input and output data buffers.
ind_ptr* Address of a flag that indicates whether a parameter or
column is actually null. For input parameters, your program
initializes ind_ptr to -1 if the user entered a null value. For
output columns, SQL initializes the location ind_ptr points to
to -1 if the column value was null. If your program does not
need to process null values, you should initialize ind_ptr to
NIL.
*
This data item is generated only when you specify RELEASE2 in the INCLUDE SQLDA directive.
Table 6-4. SQLDA Fields (page 2 of 2)
Field Name Description