Normally, format information for regular row and compute row result sets is only available while the application is processing the result set. At that time, the application can call ct_res_info to retrieve the number of items in the result set, ct_describe to get a description of each item, and ct_compute_info to get compute information.
This mechanism works well for most applications. Some applications, however, need to be able to get format information for a result set before they process the result set. An example of this type of application is a gateway application that repackages Adaptive Server Enterprise results before sending them on to a non-Sybase client.
Client-Library makes advance format information available to an application in the form of format results. There are two types of format results: regular row format results and compute row format results.
Format result sets contain no fetchable results. Instead, an application can call ct_res_info, ct_describe, and ct_compute_info to retrieve format information after ct_results indicates format results.
To receive format results, an application must set the Client-Library CS_EXPOSE_FMTS property to CS_TRUE.
An application can call ct_describe and ct_compute_info to retrieve format information.
A gateway application might use a program structure similar to the following one to process format results:
case CS_ROWFMT_RESULT
ct_res_info(CS_NUMDATA) to get the number of columns
for each column:
ct_describe to get a column description
send the information on to the gateway client
end for
end case
case CS_COMPUTEFMT_RESULT
ct_res_info to get the number of columns
for each column:
ct_describe to get a column description
(if required:
ct_compute_info for compute information
end if required)
send the information on to the gateway client
end for
end case