db_sequence_create
Prev | Chapter 11. The DB_SEQUENCE Handle | Next

## db_sequence_create

    #include <db.h>

    int db_sequence_create(DB_SEQUENCE **seq, DB *db, u_int32_t flags);

Creates a sequence handle, which can then be opened with DB_SEQUENCE->open().

`DB_SEQUENCE` handles are free-threaded if the DB_THREAD flag is specified to the DB_SEQUENCE->open() method when the sequence is opened. Once the DB_SEQUENCE->close() or DB_SEQUENCE->remove() methods are called, the handle can not be accessed again, regardless of the method's return.

Each handle opened on a sequence may maintain a separate cache of values which are returned to the application using the DB_SEQUENCE->get() method either singly or in groups depending on its delta parameter.

Calling the DB_SEQUENCE->close() or DB_SEQUENCE->remove() methods discards this handle.

`db_sequence_create()` method returns a non-zero error value on failure and 0 on success.

### Parameters

#### seq

The seq parameter references the memory into which the returned structure pointer is stored.

#### db

The db parameter is an open database handle which holds the persistent data for the sequence. The database may be of any type, but must not have been configured to support duplicate data items.

#### flags

The flags parameter is currently unused, and must be set to 0.

### Errors

The `db_sequence_create` method may fail and return one of the following non-zero errors:

#### EINVAL

An invalid flag value or parameter was specified.

### Class

DB_SEQUENCE

### See Also

Sequences and Related Methods

Prev | Up | Next
Chapter 11. The DB_SEQUENCE Handle | Home | DB_SEQUENCE->close()