Was this helpful?
Large Objects in Dynamic SQL
The following sections contain considerations and restrictions for using large object data in dynamic SQL programs.
Length Considerations
The sqllen field of the SQLDA is a 2-byte integer in which the DBMS Server returns the length of a column. If a long varchar or long byte column that is longer than the maximum value possible for sqllen (32,768) is described, a 0 is returned in sqllen.
Long varchar and long byte columns can contain a maximum of 2 GB of data. To prevent data truncation, be sure that the receiving variable to which the SQLDA sqldata field points is large enough to accommodate the data in the large object columns your program is reading. If data is truncated to fit in the receiving variable, the sqlwarn member of the sqlca structure is set to indicate truncation.
Data Handlers in Dynamic SQL
To specify a data handler routine to be called by a dynamic query that reads or writes a large object column, prepare the SQLDA fields for the large object column as follows:
Set the sqltype field to IISQL_HDLR_TYPE. This value is defined when using the include sqlda statement to define an SQLDA structure in your program.
Declare a sqlhdlr structure in your program. For details, see the Embedded SQL Companion Guide. Load the sqlhdlr field of this structure with a pointer to your data handler routine. If a variable is to be passed to the data handler, load the sqlarg field with a pointer to the variable. If no argument is to be passed, set the sqlarg field to 0.
If the value of the large object column is null (sqlind field of the SQLDA set to -1) the data handler is not invoked.
Last modified date: 11/28/2023