Berkeley DB Reference Guide:
Access Methods


Duplicating a cursor

Once a cursor has been initialized (for example, by a call to DBcursor->c_get), it can be thought of as identifying a particular location in a database. The DBcursor->c_dup method permits an application to create a new cursor that has the same locking and transactional information as the cursor from which it is copied, and which optionally refers to the same position in the database.

In order to maintain a cursor position when an application is using locking, locks are maintained on behalf of the cursor until the cursor is closed. In cases when an application is using locking without transactions, cursor duplication is often required to avoid self-deadlocks. For further details, refer to Access method locking conventions.


Copyright Sleepycat Software