Table 6-2 compares DB-Library cursor routines to Client-Library cursor routines. See:
Chapter 7, “Using Client-Library Cursors,” in the Open Client Client-Library/C Programmers Guide.
Appendix A, “Cursors,” in the Open Client DB-Library/C Reference Manual.
DB-Library equivalent |
DB-Library functionality |
Client-Library routines |
Client-Library functionality |
---|---|---|---|
dbcursoropen( dbproc, stmt, scrollopt, concuropt, nrows, pstatus) |
Open a cursor, specify the SQL statement that defines the cursor, the scroll option, the concurrency option, the number of rows in the fetch buffer, and a pointer to the array of row status indicators. |
ct_cursor(cmd, CS_CURSOR_DECLARE, name, namelen, text, textlen, option) |
Initiate a command to declare the cursor, specifying the SQL text that is the body of the cursor. option is CS_UNUSED or a bitwise OR of these values:
|
ct_cursor(cmd, CS_CURSOR_ROWS, NULL, CS_UNUSED, NULL, CS_UNUSED, nrows) |
Specify the number of rows to be returned to Client-Library per internal fetch. The default is 1. |
||
ct_cursor(cmd, CS_CURSOR_OPTION, NULL, CS_UNUSED, NULL, CS_UNUSED, option) |
Initiate a cursor set options command. option is one these values:
|
||
ct_cursor(cmd, CS_CURSOR_UPDATE, name, namelen, text, textlen, option) |
Initiate a cursor update command. option is one these values:
|
||
ct_cursor(cmd, CS_CURSOR_DELETE, name, namelen, NULL, CS_UNUSED, CS_UNUSED) |
Initiate a command to delete the cursor. |
||
ct_cursor(cmd, CS_CURSOR_DEALLOC, NULL, CS_UNUSED, NULL, CS_UNUSED, CS_UNUSED) |
Initiate a command to deallocate cursor. |
||
ct_cursor(cmd, CS_CURSOR_OPEN, NULL, CS_UNUSED, NULL, CS_UNUSED, option) |
Initiate a command to open the cursor. option is one these values:
|
||
(none) |
ct_send, ct_results |
Send and process the results of ct_cursor commands. Cursor-declare, cursor-option, and cursor-rows commands can be batched and sent as one command. Other ct_cursor commands can not be batched. |
|
dbcursorbind( hc, col, vartype, varlen, poutlen, pvaraddr) |
Register the binding information on the cursor columns. |
ct_bind(cmd, item, datafmt, buffer, copied, indicator) |
Bind cursor results to program variables. |
dbcursorfetch( hc, fetchtype, rownum) |
Fetch a block of rows into the program variables specified in the call to dbcursorbind. |
ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, rows_read) |
Fetch cursor result data. |
DB-Library does not support scrollable cursors. |
ct_scroll_fetch(cmd, type, CS_UNUSED, CS_TRUE, rows_read) |
Fetch cursor from a result set. Provide browsing ability to navigate within the result set and select single rows for further processing. |
|
none |
ct_keydata(cmd, action, colnum, buffer, buflen, outlen) |
Set (action=CS_SET) or retrieve (action=CS_GET) the contents of a key column. |
|
dbcursorclose( hc) |
Close the cursor with the given handle (hc). The cursor handle should not be reused. |
ct_cursor(cmd, CS_CURSOR_CLOSE, NULL, CS_UNUSED, NULL, CS_UNUSED, option) |
Close a cursor. option is CS_DEALLOC or CS_UNUSED If the cursor is not deallocated, the same cursor can be reopened later by calling ct_cursor with the same command structure. |