Db::associate API Ref

#include <db_cxx.h>

int Db::associate(DbTxn *txnid, Db *secondary, int (*callback)(Db *secondary, const Dbt *key, const Dbt *data, Dbt *result), u_int32_t flags);


Description: Db::associate

The Db::associate function is used to declare one database a secondary index for a primary database. After a secondary database has been "associated" with a primary database, all updates to the primary will be automatically reflected in the secondary and all reads from the secondary will return corresponding data from the primary. Note that as primary keys must be unique for secondary indices to work, the primary database must be configured without support for duplicate data items. See Secondary indices for more information.

The Db::associate 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
callback flags primary secondary txnid

Errors

The Db::associate method may fail and throw DbException, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:


DB_REP_HANDLE_DEAD

DB_REP_LOCKOUT

EINVAL


Class Db
See Also Databases and Related Methods

APIRef

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