CHAPTER 8 Transactions and Versioning

Hold cursors

Specifying the HOLD option when you open a cursor keeps the cursor open past the end of the transaction, if the transaction ends in a COMMIT. A hold cursor does not remain open across a ROLLBACK in which a cursor is opened.

Although the HOLD option is not commonly used in a DSS environment, with long transactions and no positioned updates, it may prove useful in some situations. For example, many existing applications expect to use hold cursors, and some ODBC drivers use hold cursors by default.

Adaptive Server IQ provides the version management needed for hold cursors.

Hold cursors do impact performance. All resources used by the cursor, including memory, disk space, and process threads, are held until the cursor is closed.

Positioned operations

In a positioned operation, the current location of the cursor determines where a read or write operation begins. Adaptive Server IQ supports positioned fetches, which can be helpful in long query transactions. It does not support positioned updates, which are intended for shorter insertions and deletions. For the most part, updates to IQ databases are likely to involve large amounts of data; repositioning is a very minor part of such write operations.

Cursor command syntax and examples

For more information on using cursors in procedures, including examples of cursor use, see Chapter 6, “Using Procedures and Batches”. For syntax of cursor-related commands, see the Adaptive Server IQ Reference Manual.

Controlling message logging for cursors

By default, cursor operations are not logged in the IQ message file. If you need to track cursor operations in order to determine the cause of a problem, turn on the Log_Cursor_Operations option to produce a message each time a cursor is opened or closed. See the Adaptive Server IQ Reference Manual for details.

313

Page 333
Image 333
Sybase 12.4.2 manual Hold cursors, Positioned operations, Cursor command syntax and examples, 313