1 /* index.c - routines for dealing with attribute indexes */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/string.h>
13 #include <ac/socket.h>
18 #ifdef BDB_FILTER_INDICES
33 LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
34 "key_read: enter\n" ));
36 Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
39 ldbm_datum_init( key );
41 key.dsize = k->bv_len;
43 rc = bdb_idl_fetch_key( be, db, key, idl );
46 LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
47 "key_read: %ld candidates\n",
48 idl ? ID_BLOCK_NIDS(idl) : 0 ));
50 Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n",
51 idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
60 /* Add or remove stuff from index files */
75 LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
76 "key_change: %s ID %lx\n",
77 op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long)id ));
79 Debug( LDAP_DEBUG_TRACE, "=> key_change(%s,%lx)\n",
80 op == SLAP_INDEX_ADD_OP ? "ADD":"DELETE", (long) id, 0 );
87 if (op == SLAP_INDEX_ADD_OP) {
89 rc = bdb_idl_insert_key( be, db, txn, &key, id );
93 rc = bdb_idl_delete_key( be, db, txn, &key, id );
97 LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
98 "key_change: return %d\n", rc ));
100 Debug( LDAP_DEBUG_TRACE, "<= key_change %d\n", rc, 0, 0 );