A cursor's update mode.

Use DB_CURSOR_FOR_UPDATE when reading data that will later be modified in the same transaction. This is not required to actually perform updates, but is highly recommended in concurrent applications because it prevents deadlocks.

When a cursor is in DB_CURSOR_FOR_READ mode, it obtains shared locks when data is read. This allows multiple concurrent transactions to read the same data without blocking. When a cursor is in DB_CURSOR_FOR_UPDATE mode, it will always obtain exclusive locks, regardless of whether data is read or written. Exclusive locks do not allow multiple transactions to read the same data. This prevents the possiblity of a deadlock occuring when the data is later modified.

See also:
Table::create, Table::open, Table::set_sort_order
Enumerator:
DB_CURSOR_FOR_READ  Cursor will be used primarily to read data.
DB_CURSOR_FOR_UPDATE  Cursor will be used to update data.


Copyright © 2005-2008 ITTIA®. All rights reserved.