Please enable JavaScript to view this site.

ESL Documentation

To keep track of its position in the result set, a driver maintains a cursor. Each time an application calls EDSFetch, the driver moves the cursor to the next row and returns that row. The cursor supported by the core functions only scrolls forward, one row at a time. (To re-retrieve a row of data that it has already retrieved from the result set, the application must close the cursor by calling EDSFreeStmt with the EDS_CLOSE option, re-execute the SELECT statement, and fetch rows with EDSFetch until the target row is retrieved.)

Positioned UPDATEs and DELETEs

An ESL application can update or delete the row in the result set to which the cursor is currently pointing. Such positioned UPDATE and positioned DELETE statements require cursor names. Your application can name a cursor with EDSSetCursorName. If your application has not named the cursor by the time the driver executes a SELECT statement, the driver generates a cursor name that begins with SQL_CUR and is up to 18 characters long. To retrieve the cursor name for a statement handle, call EDSGetCursorName.

To perform a positioned UPDATE statement, your application must first issue a SELECT statement to create a result set, and then fetch one or more rows to position the cursor on the desired row.

To execute a positioned UPDATE or DELETE statement, your application must follow these guidelines:

The SELECT statement that creates the result set must use a FOR UPDATE clause.

The cursor name used in the UPDATE or DELETE statement must be the same as the cursor name associated with the SELECT statement.

The application must use different statement handles for the SELECT statement and the UPDATE or DELETE statement.

The statement handles for the SELECT statement and the UPDATE or DELETE statement must be on the same connection.

Block and Scrollable Cursors

EDS supports forward and backward scrolling, absolute or relative positioning within the result set, and the ability to retrieve and update blocks of data. EDS provides the following two cursor attributes:

This Attribute:

Allows your Application to ...

Block

Retrieve blocks of data. Update blocks of data.

Scrollable

Scroll forward and backward through the result set. Move to an absolute or relative position in the result set.

Cursors can have one or both attributes. To specify the cursor type, call EDSSetScrollOptions (Level 2). Unless the cursor is a forward-only cursor, call EDSExtendedFetch to scroll the cursor backward, forward, or to an absolute or relative position in the result set. Call EDSSetPos (Level 2) to refresh the row currently pointed to by the cursor.

Cursor Concurrency

To specify the concurrency used by a cursor, call EDSSetScrollOptions. Your application can specify that the cursor is read-only, locks the result set, uses optimistic concurrency control and compares timestamps to determine if a row has changed, or uses optimistic concurrency control and compares data values to determine if a row has changed. Call EDSSetPos to lock the row currently pointed to by the cursor, regardless of the specified cursor concurrency.