skip to main content
IP API Reference for C/C++ : Returning Values for Long Data Types
 

Returning Values for Long Data Types

For long data types (LONGVARCHAR, WLONGVARCHAR, and LONGVARBINARY), OASQLIP_get_colval returns column data to the OpenAccess SDK layer as a DataChainList data structure that contains 1 or more data nodes. If you read data from your database in chunks, OpenAccess SDK allows you to retrieve those chunks and add them to a list that is read when sending the data to the client.
The IP creates the DataChainList using sqlu_createDataChain and adds data nodes to it using sqlu_addToDataChain. The IP is responsible for freeing the DataChainList object and the data buffers that are allocated and added to the chain. Call sqlu_freeDataChainList to free the list and all data nodes contained in it. These should be freed when the next row is fetched or when OASQLIP_free_stmt is called. One way to do this is to allocate a buffer for each column, keep reusing it until all rows are fetched, and free them when OASQLIP_fetch_row is called after the last row has been fetched. Alternatively, the IP can free the DataChainList when OASQLIP_free_colval is called and create a new one during the next call to the OASQLIP_get_colval.
The following code example illustrates returning binary columns for columns:
Function: OASQLIP_get_colval()
Parameter Values:
piXODataType = XO_TYPE_LONGVARBINARY
ppValAsStr = Pointer to DataChainList
plValAsStrLen = Total length of the binary data