The cursor types that the DB2ResultSet instance can use.
[Visual Basic]
<Serializable>
Public Enum DB2CursorType
[C#]
[Serializable]
public enum DB2CursorType
[C++]
[Serializable]
__value public enum DB2CursorType
[JScript]
public
Serializable
enum DB2CursorType
Member name | Description |
---|---|
ForwardOnly | The DB2ResultSet to be created will use a forward-only, non-scrollable, insensitive, and non-updatable cursor. |
Static | The DB2ResultSet to be created will use a scrollable, insensitive, and non-updatable cursor. |
Keyset | The DB2ResultSet to be created will use a scrollable, sensitive, and updatable cursor. Delete holes are visible to cursor. |
Dynamic | The DB2ResultSet to be created will use a scrollable, sensitive, dynamic, and updatable cursor. Delete holes are not visible to the cursor. |
Informix® supports only the Forward-only and Static cursor types. If the select does not have either the primary-key, serial, or row-id the cursor will be read-only.
DB2CursorType value | DB2ResultSet.Scrollable | DB2ResultSet.Updatable | DB2ResultSet.Sensitive | DB2ResultSet.SkipDeleted |
---|---|---|---|---|
Forward-only | False | False | False | False |
Static | True | False | False | False |
Keyset | True | True | True | False |
Dynamic | True | True | True | True |
When creating a DB2ResultSet instance with the DB2Command.ExecuteResultSet method, you can use either the DB2CursorType enumeration or the DB2®ResultSetOptions enumeration to define the capabilities of the DB2ResultSet instance.
The default keyset-driven cursor is a values concurrency cursor. A values concurrency cursor results in optimistic locking, where locks are not held until an update or delete is attempted. If lock concurrency was explicitly requested, then pessimistic locking is used and locks are held as soon as the row is read. (This level of locking is only supported for DB2 for Linux, UNIX, and Windows servers). When an update or delete is attempted, the database server compares the previous values that the application retrieved to the current values in the underlying table. If the values match, then the update or delete succeeds. If the values do not match, then the operation fails. If failure occurs, the application can query the values again and reissue the update or delete, if it is still applicable.
Rows added to a keyset cursor-driven DB2ResultSet object are inserted into the table on the server, but are not added to the server result set. Therefore, these rows are not updatable nor are they sensitive to changes made by other transactions. The inserted rows are part of the result set, since they are cached on the client. The application result set does not reflect any trigger actions that take place on the server side as the result set is cached before any server side initiated change. To make the inserted rows updatable, sensitive, and to see the result of applicable triggers, the application must issue the query again to regenerate the result set.
DB2ResultSet objects that use keyset cursors are supported only when you are accessing data servers that support scrollable cursors.
To insert, update, or delete rows in a dynamic scrollable cursor's result set, the result set must include all the columns of at least one unique key in the base table. The unique key can be the primary key or any other unique key.
DB2ResultSet objects with dynamic cursors are only supported when you are accessing data servers that support dynamic cursors. Currently, the dynamic cursors are supported only by the DB2 for z/OS® servers.