SQL Programming Manual for TAL
Dynamic NonStop SQL Operations
HP NonStop SQL Programming Manual for TAL—527887-001
7-25
Using the Names Buffer
Figure 7-4. Getting Parameter Values (page 1 of 2)
STRING .param^name[0:39];
! (40 is the maximum size
! of a column name).
INT namelen;
! parameter name
INT nameix;
! string
INT input^num;
INT .EXT param^(sql^types);
INT maxlen;
! parameter
INT count^read;
! value actually read
INT i;
! Prompt user for input parameter values
...
! Get number of input parameters:
input^num := sqlda^ptr.num^entries;
. . .
! current parameter name
! number of bytes in a
! index into parameter names
! number of input parameters
! pointer to parameter value
! maximum length of a string
! number of bytes of input
! loop counter
BEGIN
STRING v^char[0:MAX^SQL^CHAR^LENGTH];
STRUCT v^varchar = v^char;
BEGIN
INT len;
STRING VAL[0:MAX^SQL^CHAR^LENGTH-2];
END;
INT
INT(32)
FIXED
FIXED(3)
REAL
REAL(64)
STRING
STRING
END;
v^smallint = v^char;
v^int = v^char;
v^largeint = v^char;
v^numeric = v^char;
v^float
= v^char;
v^double = v^char;
v^decimal[0:18] = v^char;
v^datetime[0:25] = v^char;
INT PROC request^invars(sqlda^ptr, inamesbuf^ptr);
STRUCT .EXT sqlda^ptr(sqlda^type);
STRING .EXT inamesbuf^ptr;
! with parameter names
BEGIN
! Define template of TAL types that correspond to SQL types
STRUCT sql^types (*);
! input SQLDA pointer
! points to buffer
VST0704.vsd