A Client-Library cursor requires application programmers to code ct_cursor calls that declare and open the cursor. A Client-Library cursor-open command returns a single fetchable result set of type CS_CURSOR_RESULT.
A Client-Library cursor’s scope is limited to a single command structure. In fact, once a cursor is declared with a command structure, that command structure becomes a dedicated “handle” for further operations on the cursor.
Client-Library cursors provide the following advantages over language cursors:
Fetching from a Client-Library cursor is more simple.
Each fetch from a Client-Library cursor involves a single ct_fetch or ct_scroll_fetch call; after each ct_fetch or ct_scroll_fetch call that returns rows, the application can send new commands over the connection.
Each fetch from a language cursor is a separate Client-Library command that involves calls to ct_command, ct_send, ct_results, ct_fetch, and so forth. The results of the fetch language command must be completely processed before the application can send new commands over the same connection.
A Client-Library cursor can be used to modify any previously fetched row. A language cursor can only be used to delete or update the most recently fetched row.
A Client-Library cursor can be declared to execute a stored procedure (as long as the stored procedure only executes a single select statement—for more details, see “Step 1: Declare the cursor”). A language cursor must be declared with a select statement.