Table 6-2 compares DB-Library cursor routines to Client-Library cursor routines. For more information on these calls, see:
Chapter 7, “Using Client-Library Cursors,” in the Open Client Client-Library/C Programmer’s 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. Client-Library cursors have no scroll options, and only the CS_READ_ONLY option maps to a DB-Library cursor concurrency option (concuropt of CUR_READONLY). |
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_FOR_UPDATE, CS_READ_ONLY, or CS_UNUSED. |
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_OPEN, NULL, CS_UNUSED, NULL, CS_UNUSED, CS_UNUSED) |
Initiate a command to open the cursor. |
||
(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. |
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. |