public Dbc dup(int flags)
The Dbc.dup method creates a new cursor that uses the same transaction
and locker ID as the original cursor. This is useful when an application
is using locking and requires two or more cursors in the same thread of
The flags value must be set to 0 or by bitwise inclusively OR'ing together one or
more of the following values:
- The newly created cursor is initialized to refer to the same position
in the database as the original cursor and hold the same locks. If the
Db.DB_POSITION flag is not specified, then the created cursor is
uninitialized and will behave like a cursor newly created using
When using the Berkeley DB Concurrent Data Store product, there can be only one active write cursor
at a time. For this reason, attempting to duplicate a cursor for which
the Db.DB_WRITECURSOR flag was specified during creation will return
If the cursor argument is not yet initialized, the Dbc.dup method throws an exception that encapsulates Db.EINVAL.
Otherwise, the Dbc.dup method throws an exception that encapsulates a non-zero error value on
The Dbc.dup method may fail and throw an exception encapsulating a non-zero error for the following conditions:
- An invalid flag value or parameter was specified.
The cursor argument was created using the
Db.DB_WRITECURSOR flag in the Berkeley DB Concurrent Data Store product.
The Dbc.dup method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods.
If a catastrophic error has occurred, the Dbc.dup method may fail and
throw a DbRunRecoveryException,
in which case all subsequent Berkeley DB calls will fail in the same way.
Database Cursors and Related Methods
Copyright Sleepycat Software