CursorScroll

Description

When used with the CursorLock parameter, specifies scrolling options for cursors in an ODBC data source.

The location of a cursor indicates the current position in the result set produced by a SQL statement. Scrolling allows a cursor to move through the data in a result set one row at a time.

Applies to

ODBC (if driver and back-end DBMS support this feature)

Syntax

CursorScroll='scroll_value'

Parameter

Description

scroll_value

Specifies the type of scrolling you want to use for ODBC cursors. Values are:

  • Forward

    The cursor only scrolls forward through the result set.

  • Static

    The data in the result set does not change.

  • KeySet

    Specifies that the cursor is keyset-driven. When a keyset-driven cursor is opened, the driver saves keys for the entire result set. As the cursor scrolls through the result set, the driver uses the keys in this keyset to retrieve the current values for each row.

  • Dynamic

    The driver saves and uses only the keys for the rows specified in the rowset.


Default value

If you do not specify a value for CursorScroll, PowerBuilder defaults to the cursor scroll settings specified for your ODBC data source driver.

Usage

For large result sets, it might be impractical to use a keyset-driven cursor that requires the driver to save keys for the entire result set. Instead, you can use a mixed cursor by specifying a 32-bit integer value that is the number of rows in your keyset (see Example 2). This number is typically smaller than the result set. The default keyset size is 0.

A mixed cursor uses KeySet scrolling within the specified keyset and Dynamic scrolling outside the keyset.

Examples

Example 1

To set scrolling and locking options for cursors in an ODBC data source:

  • Database profile

    Select Dynamic Scrolling from the Scrolling Options drop-down list and Optimistic Using Values from the Locking drop-down list on the Transaction page in the Database Profile Setup dialog box.

  • Application

    Type the following in code:

    SQLCA.DBParm="CursorScroll='Dynamic', CursorLock='OptValue'"

Example 2

This example sets the number of rows in the keyset to 100. Assume that the entire result set has 1000 rows. When the cursor is opened, the driver saves keys for the first 100 rows of the result set. It then retrieves the next block of 100 keys until the entire result set is retrieved.

  • Database profile

    Type 100 in the Scrolling Options box on the Transaction page in the Database Profile Setup dialog box.

  • Application

    Type the following in code:

    SQLCA.DBParm="CursorScroll=100"

See also

CursorLock