Preparing the Output XSQLDA to Read Data from a Blob

From InterBase

Go Up to Reading Data from a Blob

Most queries return one or more rows of data, referred to as a select-list. An output XSQLDA must be created to store the column data for each row that is fetched. For a Blob column, the column data is an internal Blob identifier (Blob ID) that is needed to access the actual data. To prepare the XSQLDA, follow these steps:

  1. Declare a variable to hold the XSQLDA. For example, the following ­declaration creates an XSQLDA called ­out_sqlda:
    XSQLDA *out_sqlda;
  2. Allocate memory for the XSQLDA using the XSQLDA_LENGTH macro. The XSQLDA must contain one XSQLVAR substructure for each column to be fetched. The following statement allocates storage for an output XSQLDA (out_sqlda) with three XSQLVAR substructures:
    out_sqlda = (XSQLDA *)malloc(XSQLDA_LENGTH(3));
  3. Set the version field of the XSQLDA to SQLDA_CURRENT_VERSION, and set the sqln field of the XSQLDA to indicate the number of XSQLVAR substructures allocated:
    out_sqlda->version = SQLDA_CURRENT_VERSION;
    out_sqlda->sqln = 3;

Advance To: