Determining how many SQLVAR occurrences are needed

The number of SQLVAR occurrences needed depends on the statement that the SQLDA was provided for and the data types of the columns or parameters being described. See the tables above for more information.

The 7th byte of SQLDAID is always set to the number of sets of SQLVARs necessary.

If SQLD is not set to a sufficient number of SQLVAR occurrences:

Table 94, Table 95, and Table 96 show how to map the base and extended SQLVAR entries. For an SQLDA that contains both base and extended SQLVAR entries, the base SQLVAR entries are in the first block, followed by a block of extended SQLVAR entries, which if necessary, are followed by a second or third block of extended SQLVAR entries. In each block, the number of occurrences of the SQLVAR entry is equal to the value in SQLD even though many of the extended SQLVAR entries might be unused.

Table 94. Contents of SQLVAR Arrays for USING NAMES, USING SYSTEM NAMES, USING LABELS or USING ANY
LOBs DISTINCT types 7th byte of SQLDAID SQLN Minimum First Set (Base) Second Set (Extended) Third Set (Extended) Fourth Set (Extended)
No No Blank n Column names, system column names, or labels Not used Not used Not used
Yes No 2 2n Column names, system column names, or labels LOBs Not used Not used
No Yes 2 2n Column names, system column names, or labels Distinct types Not used Not used
Yes Yes 2 2n Column names, system column names, or labels LOBs and distinct types Not used Not used

 

Table 95. Contents of SQLVAR Arrays for USING BOTH
LOBs DISTINCT types 7th byte of SQLDAID SQLN Minimum First Set (Base) Second Set (Extended) Third Set (Extended) Fourth Set (Extended)
No No 2 2n Column names Labels Not used Not used
Yes No 2 2n Column names LOBs and labels Not used Not used
No Yes 3 3n Column names Distinct types Labels Not used
Yes Yes 3 3n Column names LOBs and distinct types Labels Not used

 

Table 96. Contents of SQLVAR Arrays for USING ALL
LOBs DISTINCT types 7th byte of SQLDAID SQLN Minimum First Set (Base) Second Set (Extended) Third Set (Extended) Fourth Set (Extended)
No No 3 3n System column names Labels Column names Not used
Yes No 3 3n System column names LOBs and labels Column names Not used
No Yes 4 4n System column names Distinct types Labels Column names
Yes Yes 4 4n System column names LOBs and distinct types Labels Column names