1 /* index.c - routines for dealing with attribute indexes */
4 * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/string.h>
13 #include <ac/socket.h>
33 LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
34 "key_read: enter\n" ));
36 Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
42 rc = bdb_idl_fetch_key( be, db, txn, &key, ids );
44 if( rc != LDAP_SUCCESS ) {
46 LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
47 "bdb_key_read: failed (%d)\n",
50 Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read: failed (%d)\n",
55 LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
56 "bdb_key_read: %ld candidates\n", (long) BDB_IDL_N(ids) ));
58 Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read %ld candidates\n",
59 (long) BDB_IDL_N(ids), 0, 0 );
66 /* Add or remove stuff from index files */
81 LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
82 "key_change: %s ID %lx\n",
83 op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long) id ));
85 Debug( LDAP_DEBUG_TRACE, "=> key_change(%s,%lx)\n",
86 op == SLAP_INDEX_ADD_OP ? "ADD":"DELETE", (long) id, 0 );
92 if (op == SLAP_INDEX_ADD_OP) {
94 rc = bdb_idl_insert_key( be, db, txn, &key, id );
98 rc = bdb_idl_delete_key( be, db, txn, &key, id );
102 LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
103 "key_change: return %d\n", rc ));
105 Debug( LDAP_DEBUG_TRACE, "<= key_change %d\n", rc, 0, 0 );