If this function is not called by a table operator with parameter style SQLTABLE, FNC_TblOpGetColDef sets an error.
Before calling FNC_TblOpGetColDef, you should invoke the following function and macro to allocate space for the buffer where the column definitions will be returned. Get the column count once and save it for use multiple times to avoid unnecessary FNC call overhead.
FNC_TblOpColumnDef_t *coldef; int ColCount = FNC_TblOpGetColCount(0, 'R'); coldef = FNC_malloc(TblOpSIZECOLDEF(ColCount));
Function FNC_TblOpGetColCount retrieves the number of columns in an input stream and TblOpSIZECOLDEF computes the required size in bytes to store the column definitions of the input stream.
After memory is allocated, use the following macro to initialize the data structure:
After initialization, function FNC_TblOpGetColDef can be called:
FNC_TblOpGetColDef(0, 'R', coldef);
Once the table operator is done with the column definitions in coldef, you need to release the memory: