Berkeley DB: DbSequence::stat
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++

### DbSequence::stat |

`

###

    #include <db_cxx.h>

    int
    Db::stat(void *sp, u_int32_t flags);

    int
    Db::stat_print(u_int32_t flags);

### Description: DbSequence::stat

The DbSequence::stat method creates a statistical structure and copies a pointer to it into user-specified memory locations. Specifically, if sp is non-NULL, a pointer to the statistics for the database are copied into the memory location to which it refers.

Statistical structures are stored in allocated memory. If application-specific allocation routines have been declared (see DbEnv::set_alloc for more information), they are used to allocate the memory; otherwise, the standard C library malloc(3) is used. The caller is responsible for deallocating the memory. To deallocate the memory, free the memory reference; references inside the returned memory need not be individually freed.

In the presence of multiple threads or processes accessing an active sequence, the information returned by DbSequence::stat may be out-of-date.

The DbSequence::stat method cannot be transaction-protected. For this reason, it should be called in a thread of control that has no open cursors or active transactions.

The statistics are stored in a structure of type DB_SEQUENCE_STAT. The following fields will be filled in:

u_int32_t st_wait;
  The number of times a thread of control was forced to wait on the handle mutex.
u_int32_t st_nowait;
  The number of times that a thread of control was able to obtain handle mutex without waiting.
db_seq_t st_current;
  The current value of the sequence in the database.
db_seq_t st_value;
  The current cached value of the sequence.
db_seq_t st_last_value;
  The last cached value of the sequence.
db_seq_t st_min;
  The minimum permitted value of the sequence.
db_seq_t st_max;
  The maximum permitted value of the sequence.
int32_t st_cache_size;
  The number of values that will be cached in this handle.
u_int32_t st_flags;
  The flags value for the sequence.

### Parameters

flags
  The flags parameter must be set by bitwise inclusively OR'ing together one or more of the following values:
  DB_STAT_CLEAR
    Reset statistics after printing their values.

The DbSequence::stat method may not be called before the DbSequence::open method has been called.

The DbSequence::stat 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.

### Description: DbSequence::stat_print

The DbSequence::stat_print method prints diagnostic information to the output channel described by the DbEnv::set_msgfile method.

### Parameters

flags
  The flags parameter must be set by bitwise inclusively OR'ing together one or more of the following values:
  DB_STAT_CLEAR
    Reset statistics after printing their values.

### Class

DbSequence

### See Also

Sequences and Related Methods`

Copyright (c) 1996,2007 Oracle. All rights reserved.