DB->associate API Ref

#include <db.h>

int DB->associate(DB *primary, DB_TXN *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 returns a non-zero error value on failure and 0 on success.

Parameters
callback flags primary secondary txnid

Errors

The DB->associate method may fail and 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.