#include <db_cxx.h> int DbSequence::open(DbTxn *txnid, Dbt *key, u_int32_t flags);
The DbSequence::open()
method opens the
sequence represented by the key.
The key must be compatible with the underlying database specified
in the corresponding call to
DbSequence
.
The DbSequence::open()
method either returns a non-zero error value or throws an
exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
The flags parameter must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values:
DB_CREATE
Create the sequence. If the sequence does not
already exist and the DB_CREATE
flag is not specified, the
DbSequence::open()
method will
fail.
DB_EXCL
Return an error if the sequence already exists.
This flag is only meaningful when specified with
the DB_CREATE
flag.
Cause the DbSequence
handle returned by DbSequence::open()
to be
free-threaded; that is, usable by multiple
threads within a single address space. Note that if multiple threads
create multiple sequences using the same database handle that handle
must have been opened specifying this flag.
Be aware that enabling this flag will serialize calls to DB when using the handle across threads. If concurrent scaling is important to your application we recommend opening separate handles for each thread (and not specifying this flag), rather than sharing handles between threads.
If the operation is part of an application-specified transaction, the txnid parameter is a transaction handle returned from DbEnv::txn_begin() ; if the operation is part of a Berkeley DB Concurrent Data Store group, the txnid parameter is a handle returned from DbEnv::cdsgroup_begin() ; otherwise NULL. If no transaction handle is specified, but the operation occurs in a transactional database, the operation will be implicitly transaction protected. Transactionally protected operations on a DbSequence handle require the DbSequence handle itself be transactionally protected during its open if the open creates the sequence.