Using the SQLDA Data Structure

Embedded SQL for C and SQL Server

Embedded SQL for C and SQL Server

Using the SQLDA Data Structure

When the number or data types of host variables to be passed are unknown at compile time, use dynamic SQL statements and the SQL descriptor area (SQLDA) data structure instead of static SQL statements and host variables. You can use the SQLDA data structure to define the type of data to be passed from the database to the host variable, or vice versa. The SQLDA data structure generally includes question marks (?) for parameter markers to specify input values for prepared Embedded SQL statements. You can also use the SQLDA data structure with the DESCRIBE or PREPARE INTO statements to receive data from a prepared SELECT statement. Although you cannot use the SQLDA data structure with static SQL statements, you can use it with a cursor FETCH statement, regardless of whether the cursor is dynamic or static.

Note  For text and image data, the maximum length of the data column is the size of sqllen, which is 32 KB. Sqllen is of the data type short.