|
DBcursor->c_dup
|
|
#include <db.h>
int
DBC->c_dup(DBC *cursor, DBC **cursorp, u_int32_t flags);
Description
The DBcursor->c_dup function 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
control.
The flags value must be set to 0 or by bitwise inclusively OR'ing together one or
more of the following values:
- DB_POSITION
- 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_POSITION flag is not specified, then the created cursor is
uninitialized and will behave like a cursor newly created using
DB->cursor.
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_WRITECURSOR flag was specified during creation will return
an error.
If the cursor argument is not yet initialized, the DBcursor->c_dup function will return EINVAL.
Otherwise, the DBcursor->c_dup function returns a non-zero error value on failure and 0 on success.
Errors
The DBcursor->c_dup function may fail and return a non-zero error for the following conditions:
- EINVAL
- An invalid flag value or parameter was specified.
The cursor argument was created using the
DB_WRITECURSOR flag in the Berkeley DB Concurrent Data Store product.
The DBcursor->c_dup function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions.
If a catastrophic error has occurred, the DBcursor->c_dup function may fail and return
DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail
in the same way.
See Also
DBcursor->c_close,
DBcursor->c_count,
DBcursor->c_del,
DBcursor->c_dup,
DBcursor->c_get,
DBcursor->c_pget,
and
DBcursor->c_put.
Copyright Sleepycat Software
|