ASA Programming Guide
Embedded SQL Programming
The method for sending and retrieving LONG VARCHAR and LONG BINARY values in embedded SQL applications is different from that for other data types. Although the standard SQLDA fields can be used, they are limited to 32 kb data as the fields holding the information (sqldata, sqllen, sqlind) are 16-bit values. Changing these values to 32-bit values would break existing applications.
The method of describing LONG VARCHAR and LONG BINARY values is the same as for other data types.
For information about how to retrieve and send values, see Retrieving LONG data, and Sending LONG data.
Separate structures are used to hold the allocated, stored, and untruncated lengths of LONG BINARY and LONG VARCHAR data types. The static SQL data types are defined in sqlca.h as follows:
#define DECL_LONGVARCHAR( size ) \ struct { a_sql_uint32 array_len; \ a_sql_uint32 stored_len; \ a_sql_uint32 untrunc_len; \ char array[size+1];\ } #define DECL_LONGBINARY( size ) \ struct { a_sql_uint32 array_len; \ a_sql_uint32 stored_len; \ a_sql_uint32 untrunc_len; \ char array[size]; \ }
For dynamic SQL, set the sqltype field to DT_LONGVARCHAR or DT_LONGBINARY as appropriate. The associated LONGBINARY and LONGVARCHAR structures are as follows:
typedef struct LONGVARCHAR { a_sql_uint32 array_len; /* number of allocated bytes in array */ a_sql_uint32 stored_len; /* number of bytes stored in array * (never larger than array_len) */ a_sql_uint32 untrunc_len; /* number of bytes in untruncated expression * (may be larger than array_len) */ char array[1]; /* the data */ } LONGVARCHAR, LONGBINARY;
For information about how to implement this feature in your applications, see Retrieving LONG data, and Sending LONG data.
Retrieving LONG data
Sending LONG data