The DB2ResultSetOptions enumeration is used to specify options for the DB2ResultSet class. The DB2ResultSetOptions Enumeration consists of bit flags, which can be combined with a bitwise operation.
[Visual Basic]
<Serializable>
Public Enum DB2ResultSetOptions
[C#]
[Serializable]
public enum DB2ResultSetOptions
[C++]
[Serializable]
__value public enum DB2ResultSetOptions
[JScript]
public
Serializable
enum DB2ResultSetOptions
Member name | Bit value | Description |
---|---|---|
None | 0 | No options. A forward-only cursor is specified for the DB2ResultSet object. |
Scrollable | 1 | A scrollable cursor is specified for the DB2ResultSet object. |
Sensitive | 2 | A sensitive, scrollable cursor that can see updates and inserts that are made by the application or other cursors is specified for the DB2ResultSet object. |
SkipDeleted | 8 | A sensitive, scrollable cursor that skips rows that were deleted by itself or other cursors is specified for the DB2ResultSet object. With the SkipDeleted option, it is not possible to assume a position on a row that is marked as deleted (for example, when IsDeleted() returns true.) |
Updatable | 4 | A cursor that can be updated is specified for the DB2ResultSet object. |
Informix® databases support only the ForwardOnly and Static cursor types. If the SELECT statement does not have the primary key, serial, or row ID, the cursor is read-only.
Combination | None | Scrollable | Updatable | Sensitive | SkipDeleted | DB2ResultSet.CursorType |
---|---|---|---|---|---|---|
Combination 1 | X | ForwardOnly | ||||
Combination 2 | X | Static | ||||
Combination 3 | X | X | Keyset | |||
Combination 4 | X | X | X | Keyset | ||
Combination 5 | X | X | X | Keyset | ||
Combination 6 | X | X | X | X | Keyset |
When you create a DB2ResultSet object with the DB2Command.ExecuteResultSet method, you can use either the DB2ResultSetOptions enumeration or the DB2CursorType enumeration to define the capabilities of the DB2ResultSet instance. The previous table shows the DB2ResultSet.CursorType values that correspond to each acceptable combination of DB2ResultSetOptions values. If your application requires a DB2ResultSet object that uses a Dynamic cursor, you must run the DB2Command.ExecuteResultSet method with the DB2CursorType.Dynamic enumeration value.
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.