SQL Programming Manual for Pascal
Using Dynamic SQL
HP NonStop SQL Programming Manual for Pascal—528614-001
7-32
Displaying Output
Figure 7-9. Displaying Output (page 1 of 2)
SQLVAR_SIZE := SIZEOF(SQLVAR_TYPE);
PROCEDURE DISPLAY_SELECTED_VALUES
(NAMESBUF_PTR: CHAR_BUF_TYPE;
OUTPUT_SQLDA_PTR : SQLDA_HEADER_TYPE);
VAR
NUM_COLUMNS : INTEGER;
DATA_TYPE : INTEGER;
{ output }
I, J : INTEGER;
LEN : INTEGER;
SQLVAR_SIZE : INTEGER;
NAMES_PTR : PTR_TO_ANY;
VALUE_PTR : PTR_TO_ANY;
SQLVAR_PTR : PTR_TO_ANY;
{ structure }
{ number of output columns }
{ data type of value to be }
{ loop counters }
{ length of an output value }
{ size of an SQLVAR structure }
{ ptr to names buffer }
{ ptr to output value }
BEGIN
{ Get the number of output columns: }
NUM_COLUMNS := OUTPUT_SQLDA_PTR^.NUM_ENTRIES;
{ Copy the names buffer pointer into a variable to }
{ to override type checking: }
NAMES_PTR.CHAR_FIELD := NAMESBUF_PTR;
{ Position output SQLDA pointer to the first SQLVAR }
{ structure, moving past the header. SQLDA_HEADER was }
{ declared globally: }
SQLVAR_PTR.SQLVAR_FIELD := OUTPUT_SQLDA_PTR;
OUTPUT_SQLDA_PTR.INT32_FIELD :=
OUTPUT_SQLDA_PTR.INT32_FIELD + SIZEOF(SQLDA_HEADER);
{ Calculate the size of a character and the size of an }
{ SQLVAR_TYPE was declared globally: }
{ SQLVAR entry, for later use in advancing pointers. }
VST0709.vsd