Was this helpful?
Structure of the SQLDA
Storage for the SQLDA structure is typically allocated at runtime. If a program allows several dynamically defined cursors to be opened at one time, the program can allocate several SQLDA structures, one for each SELECT statement, and assign each structure a different name.
Each host language has different considerations for the SQLDA structure. Before writing a program that uses the SQLDA, see the Embedded SQL Companion Guide on dynamic OpenSQL statements.
The layout of the SQLDA is:
sqldabc
8‑byte character array assigned a blank‑padded value, “SQLDA.”
sqldabc
4‑byte integer assigned the size of the SQLDA.
sqln
2‑byte integer indicating the number of allocated sqlvar elements. This value must be set by the program before describing a statement. The value must be greater than or equal to zero.
sqld
2‑byte integer indicating the number of result columns associated with the DESCRIBE statement. This number specifies how many of the allocated sqlvar elements were used to describe the statement. If sqld is greater than sqln, then the program must reallocate the SQLDA to provide more storage buffers and reissue the DESCRIBE statement.
To use the SQLDA to place values in a table or form, the program must set sqld to the proper number before the SQLDA is used in a statement.
When describing a dynamic OpenSQL statement, if the value in sqld is zero, the described statement is not a SELECT statement.
sqlvar
An sqln‑size array of:
sqltype
2‑byte integer containing a code number indicating the data type of the column or variable. For a list of the codes and corresponding types, see Data Type Codes.
sqllen
2‑byte integer indicating the length of the column, variable, or field.
sqldata
Pointer to the variable described by the type and length.
sqlind
Pointer to indicator variable associated with the host variable.
sqlname
String containing the result column name (if a SELECT statement is being described). Maximum length is 32 bytes.
Last modified date: 11/28/2023