The wide_compute.c sample program demonstrates how to process compute results with wide tables and larger column sizes. It:
Sends a query to the server using a language command.
Processes the results using the standard ct_results while loop.
Binds the column values to program variables.
Fetches and displays the rows in the standard ct_fetch while loop.
This sample requires the pubs2 database.
This is the query:
select type, price from titles where type like "%cook" order by type, price compute sum(price) by type compute sum(price)
This query returns both regular rows and rows that are returned by a compute clause. The computed rows are generated by the two compute clauses:
The first compute clause generates a compute row each time the value of type changes:
compute sum(price) by type
The second compute clause generates one compute row, which is the last to be returned:
compute sum(price)