SQL Programming Manual for Pascal

Using Dynamic SQL
HP NonStop SQL Programming Manual for Pascal528614-001
7-17
Dynamically Allocating Memory
You can use SQLVAR_TYPE to declare variables to store the descriptions of input
parameters and output variables.
Handling the SQLVAR Array. If you issue INCLUDE SQLDA, the system declares the
SQLVAR array as ARRAY [1.. sqlvar_count ] OF SQLVAR_TYPE. In this case, you
can access the SQLVAR records with array notation.
If you explicitly declare the SQLDA, you can use pointer notation to position to the first
SQLVAR record as follows. Assume that SQLVAR_PTR is a pointer to the first instance
of SQLVAR_TYPE. The following code positions to the first SQLVAR record:
SQLVAR_PTR.INT32_FIELD :=
SQLVAR_PTR.INT32_FIELD + SIZEOF(SQLDA_HEADER);
Figure 7-1. Sample SQLDA TYPE Declaration
Note. If you explicitly declare the SQLDA, you might need to change the declaration from
release to release.
SQLDA_HEADER_TYPE = RECORD
eye_catcher : fstring(2);
num_entries : integer;
END;
P_SQLDA_HEADER = ^SQLDA_HEADER_TYPE;
null_info : integer;
var_ptr : extaddr;
ind_ptr : extaddr;
reserved : longint;
END;
1: (data_len : integer);
2: (scale : byte;
nlen : byte);
3: (dt_qualifier : byte;
dt_len : byte) );
(case integer of
1: (precision : integer);
2: (lead_field_precision : byte;
fraction_precision : byte) );
CONST
SQLDA_EYE_CATCHER = 'D1';
TYPE
SQLVAR_TYPE = RECORD
data_type : integer;
(case integer of
VST0701.vsd