Assume that the result table contains 20 columns (none of which are LOB columns). In this situation, you must allocate a second SQLDA structure, fulsqlda with at least 20 SQLVAR elements (or 40 elements if the result table contains any LOBs or distinct types). For the rest of this example, assume that no LOBs or distinct types are in the result table.
When you calculate the storage requirements for SQLDA structures, include the following items:The number of SQLVAR entries needed for fulsqlda is specified in the SQLD field of minsqlda. Assume this value is 20. Therefore, the storage allocation required for fulsqlda is:
16 + (20 * sizeof(struct sqlvar))
This value represents the size of the header plus 20 times the size of each SQLVAR entry, giving a total of 896 bytes.
You can use the SQLDASIZE macro to avoid doing your own calculations and to avoid any version-specific dependencies.