Library Version 18.1.40

DB->sort_multiple()
Prev | Chapter 2. The DB Handle | Next

## DB->sort_multiple()

    #include <db.h>

    int
    DB->sort_multiple(DB *db, DBT *key, DBT *data, u_int32_t flags);

The `DB->sort_multiple()` method is used to sort a set of DBTs into database insert order.

If specified the application specific btree comparison and duplicate comparison functions will be used if they are configured.

The key and data parameters must contain pairs of items. That is the n-th entry in key must correspond to the n-th entry in data.

The `DB->sort_multiple()` method returns a non-zero error value on failure and 0 on success.

### Parameters

#### key

The key parameter must contain a set of DBT entries in DB_MULTIPLE or DB_MULTIPLE_KEY format.

The sorted entries will be returned in the key parameter.

#### data

If non-NULL, the data parameter must contain a set of DBTs entries in DB_MULTIPLE format. Each entry must correspond to an entry in the key parameter.

#### flags

The flags parameter must be set to one of the following values:

- DB_MULTIPLE

  Sorts one or two DB_MULTIPLE format DBTs. Assumes that key and data specify pairs of key and data items to sort together. If the data parameter is NULL the API will sort the key arrays according to the btree comparison function.

- DB_MULTIPLE_KEY

  Sorts a DB_MULTIPLE_KEY format DBT.

### Errors

The `DB->sort_multiple()` method may fail and return one of the following non-zero errors:

#### EACCES

An attempt was made to modify a read-only database.

#### EINVAL

An invalid flag value or parameter was specified.

### Class

DB

### See Also

Database and Related Methods

DBT and Bulk Operations

Prev | Up | Next
DB->slice_lookup() | Home | DB->stat()