#include "slap.h"
#include "back-bdb.h"
+#include "idl.h"
-#ifdef BDB_FILTER_INDICES
/* read a key */
int
bdb_key_read(
ID *ids
)
{
- DBT key;
+ int rc;
+ DBT key;
#ifdef NEW_LOGGING
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
#endif
- DBzero( &key );
- key.data = k->bv_val;
- key.size = k->bv_len;
+ DBTzero( &key );
+ bv2DBT(k,&key);
- rc = bdb_idl_fetch_key( be, db, txn, key, ids );
+ rc = bdb_idl_fetch_key( be, db, txn, &key, ids );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
} else {
#ifdef NEW_LOGGING
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
- "bdb_key_read: %ld candidates\n",
- idl ? ID_BLOCK_NIDS(idl) : 0 ));
+ "bdb_key_read: %ld candidates\n", (long) BDB_IDL_N(ids) ));
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read %ld candidates\n",
- idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
+ (long) BDB_IDL_N(ids), 0, 0 );
#endif
}
return rc;
}
-#endif
-#ifdef BDB_INDEX
/* Add or remove stuff from index files */
int
bdb_key_change(
#ifdef NEW_LOGGING
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
"key_change: %s ID %lx\n",
- op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long)id ));
+ op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long) id ));
#else
Debug( LDAP_DEBUG_TRACE, "=> key_change(%s,%lx)\n",
op == SLAP_INDEX_ADD_OP ? "ADD":"DELETE", (long) id, 0 );
#endif
DBTzero( &key );
- key.data = k->bv_val;
- key.size = k->bv_len;
+ bv2DBT(k,&key);
if (op == SLAP_INDEX_ADD_OP) {
/* Add values */
return rc;
}
-#endif