Fetching Array Data from Selected Rows

From InterBase

Go Up to Reading Data from an Array


A looping construct is used to fetch (into the output XSQLDA) the column data for a single row at a time from the select-list and to process each row before the next row is fetched. Each execution of isc_dsql_fetch() fetches the column data for the next row into the corresponding XSQLVAR structures of out_sqlda. For the array column, the array ID, not the actual array data, is fetched.

ISC_STATUS fetch_stat;
long SQLCODE;
. . .
while ((fetch_stat = j
isc_dsql_fetch(status_vector, &stmt, 1, out_sqlda)) == 0) {
/* Read and process the array data */
}
if (fetch_stat != 100L) {
/* isc_dsql_fetch returns 100 if no more rows remain to be retrieved */
SQLCODE = isc_sqlcode(status_vector);
isc_print_sqlerror(SQLCODE, status_vector);
return(1);
}

Advance To: