Viewing file: seq_get.html (3.72 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
Berkeley DB: DbSequence::get
DbSequence::get
|
 |
#include <db_cxx.h>
int
DbSequence::get(DbTxn *txnid, int32_t delta, db_seq_t *retp, u_int32_t flags);
Description: DbSequence::get
The DbSequence::get method returns the next available element in the sequence
and changes the sequence value by delta. The value of
delta must be greater than zero. If there are enough cached
values in the sequence handle then they will be returned. Otherwise the
next value will be fetched from the database and incremented
(decremented) by enough to cover the delta and the next batch
of cached values.
If the underlying database handle was opened in a transaction then
either the txnid parameter must be a valid transaction handle or
DB_AUTO_COMMIT must be specified. The txnid handle must be NULL
if the sequence handle was opened with a non-zero cache size.
For maximum concurrency a non-zero cache size should be specified prior
to opening the sequence handle and DB_AUTO_COMMIT | DB_TXN_NOSYNC should
be specified each DbSequence::get method call.
The DbSequence::get method will return EINVAL if the record in the database is not a valid sequence record,
or the sequences have overflowed is range.
Parameters
- delta
- Specifies the amount to increment or decrement the sequence.
- flags
- The flags parameter must be set to 0 or by bitwise inclusively OR'ing together one
or more of the following values:
- DB_AUTO_COMMIT
- If the database
must be updated the update will be enclosed in a transaction
and will be recoverable.
- DB_TXN_NOSYNC
- If a DB_AUTO_COMMIT
triggers a transaction, do not synchronously flush the log.
- retp
- retp points to the memory to hold the return value from
the sequence.
- txnid
- If the operation is to be transaction-protected,
the txnid parameter is a transaction handle returned from
DbEnv::txn_begin; otherwise, NULL.
Class
DbSequence
See Also
Sequences and Related Methods
Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.
|