Table 2-4 summarizes the types of cursor commands a client can issue. The “Command” column in the table shows the value in the CURSOR_COMMAND field of the CURSOR_DESC structure.
Command |
Action |
---|---|
TDS_CURSOR_DECLARE 0x001 |
Associate a cursor ID with the body of the cursor. |
TDS_CURSOR_OPENCMD 0x002 |
Execute the body of the cursor and generate a cursor result set. |
TDS_CURSOR_FETCH 0x003 |
Fetch rows from the cursor result set. |
TDS_CURSOR_DELETE 0x004 |
Delete the contents of the current cursor row. |
TDS_CURSOR_UPDATE 0x005 |
Update the contents of the current cursor row. |
TDS_CURSOR_INFO 0x006 |
Report the status of the cursor, or set the cursor row fetch count. |
TDS_CURSOR_CLOSE 0x007 |
Make the cursor result set unavailable. Reopening a cursor regenerates the cursor result set. |
TDS_CURSOR_DEALLOC 0x008 |
Render the cursor nonexistent. A cursor that is deallocated cannot be re-opened. |
A typical client application issues cursor commands in the order in which they are listed in Table 2-4, but the order can vary. For example, a client can fetch against a cursor, close the cursor, then reopen and fetch it again.
Because a client and server can exchange information about multiple cursors in a single connection session, they need a means of uniquely identifying each cursor. An Open ServerConnect application responds to a cursor declaration by sending back a unique cursor ID. The ID is an integer. The client and the server refer to the cursor by this ID for the lifetime of the cursor.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |