Db::sort_multiple()

#include <db_cxx.h>
 
int
Db::sort_multiple(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 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.

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 throw a DbException exception, encapsulating one of the following non-zero errors, or 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