The options to use with DB2ResultSet. These options are bit flags, which enable you to combine them in bit masks.
[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. In this case, the DB2ResultSet to be created will use a forward-only cursor. |
Scrollable | 1 | The DB2ResultSet to be created will be scrollable. |
Sensitive | 2 | The DB2ResultSet to be created will use a sensitive, scrollable cursor that can see updates and inserts made by the application or other cursors. |
SkipDeleted | 8 | The DB2ResultSet to be created will use a sensitive, scrollable cursor that skips rows that have been deleted by itself or other cursors. With this option, it is not possible to assume a position on a row that is marked as deleted (for instance, when IsDeleted() returns true.) |
Updatable | 4 | The DB2ResultSet to be created will use a cursor that can be updated. |
Informix® supports only the ForwardOnly and Static cursor types. If the select does not have either the primary-key, serial, or row-id the cursor will be 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 creating a DB2ResultSet instance 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 that uses a Dynamic cursor, you must run the DB2Command.ExecuteResultSet method using 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 has been explicitly requested, then pessimistic locking will be used and locks will be held as soon as the row is read. (This level of locking is only supported for DB2 on Linux, UNIX and Windows servers.) When an update or delete is attempted, the database server compares the previous values 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 should query the values again and re-issue the update or delete, if it is still applicable.
Rows added to a keyset cursor-driven DB2ResultSet are inserted into the table on the server, but are not added to the server's result set. Therefore, these rows are not updatable nor are they sensitive to changes made by other transactions. The inserted rows will appear, however, to be part of the result set, since they are cached on the client. Any triggers that apply to the inserted rows will appear to the application as if they have not been applied. 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.
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. This can be the primary key or any other unique key.
DB2ResultSet instances using dynamic cursors are only supported when accessing data servers that support dynamic cursors. At this time, the dynamic cursors are supported only by the DB2 for z/OS servers.