SQL/MP Programming Manual for C

Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for C429847-008
10-3
Dynamic SQL Features
Dynamic SQL Features
SQLDA Structure, Names Buffer, and Collation Buffer
NonStop SQL/MP uses the SQLDA structure to return information about input
parameters and output variables in dynamic SQL statements. The SQLDA structure
also provides a pointer to these buffers:
Names buffer––Receives the names of input parameters or output variables
Collation buffer––Receives copies of any collations used by columns in the query
You can use the SQLDA structure in these statements:
A DESCRIBE INPUT statement to get information about input parameters
A DESCRIBE statement to return information about output columns or copies of
any collations used by the columns
The USING DESCRIPTOR clause of a FETCH statement to fill a cursor with rows
from an SQL table
The USING DESCRIPTOR clause of an EXECUTE statement to run a dynamic
SQL statement
Declaring the SQLDA Structure
To declare an SQLDA structure, use the INCLUDE SQLDA directive as follows:
sqlda-name
is the SQLDA structure name; it must follow the conventions for a C identifier.
sqlvar-count
is the number of input parameters (plus indicator parameters) for which you expect
to specify values, or the number of columns for which you expect to receive output
values. The C compiler creates a separate SQLVAR structure within the SQLDA
structure for each parameter or column.
The default for sqlvar-count is 1.
INCLUDE SQLDA ( sqlda-name [ , sqlvar-count ]
[ , names-buffer, max-name-length ]
[ , release-option ]
[ , CPRULES collation-buffer, max-collation-size ] ) ;