LDAP_BEGIN_DECL
-#define BDB_INDEX 1
+/* #define BDB_INDEX 1 */
/* #define BDB_REINDEX 1 */
/* #define BDB_FILTER_INDICES 1 */
#define BDB_CONFIG_INDICES 1
-/* config.c - ldbm backend configuration file routine */
+/* config.c - bdb backend configuration file routine */
/* $OpenLDAP$ */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
-/* delete.c - ldbm backend delete routine */
+/* delete.c - bdb backend delete routine */
/* $OpenLDAP$ */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
-/* extended.c - ldbm backend extended routines */
+/* extended.c - bdb backend extended routines */
/* $OpenLDAP$ */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
*text = "not supported within naming context";
return LDAP_OPERATIONS_ERROR;
-}
\ No newline at end of file
+}
+
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
- "<= bdb_equality_candidates: (%s%s) MR filter failed (%d)\n",
- "", "", rc );
+ "<= bdb_equality_candidates: MR filter failed (%d)\n",
+ rc, 0, 0 );
return 0;
}
if( keys == NULL ) {
Debug( LDAP_DEBUG_TRACE,
- "<= bdb_equality_candidates: no keys (%s%s)\n",
- "", "", 0 );
+ "<= bdb_equality_candidates: no keys\n",
+ 0, 0, 0 );
return 0;
}
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
- "<= approx_candidates: (%s%s) MR filter failed (%d)\n",
- dbname, LDBM_SUFFIX, rc );
+ "<= approx_candidates: (%s) MR filter failed (%d)\n",
+ dbname, rc, 0 );
return idl;
}
if( keys == NULL ) {
Debug( LDAP_DEBUG_TRACE,
- "<= approx_candidates: no keys (%s%s)\n",
- dbname, LDBM_SUFFIX, 0 );
+ "<= approx_candidates: no keys (%s)\n",
+ dbname, 0, 0 );
return idl;
}
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
- "<= approx_candidates db open failed (%s%s)\n",
- dbname, LDBM_SUFFIX, 0 );
+ "<= approx_candidates db open failed (%s)\n",
+ dbname, 0, 0 );
return idl;
}
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
- "<= substrings_candidates: (%s%s) MR filter failed (%d)\n",
- dbname, LDBM_SUFFIX, rc );
+ "<= substrings_candidates: (%s) MR filter failed (%d)\n",
+ dbname, rc, 0 );
return idl;
}
if( keys == NULL ) {
Debug( LDAP_DEBUG_TRACE,
- "<= substrings_candidates: (0x%04lx) no keys (%s%s)\n",
- mask, dbname, LDBM_SUFFIX );
+ "<= substrings_candidates: (0x%04lx) no keys (%s)\n",
+ mask, dbname, 0 );
return idl;
}
- db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_READER );
+ rc = bdb_db_cache( be, dbname, &db );
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
- "<= substrings_candidates db open failed (%s%s)\n",
- dbname, LDBM_SUFFIX, 0 );
+ "<= substrings_candidates db open failed (%s)\n",
+ dbname, 0, 0 );
return idl;
}
return 0;
}
+int
+bdb_idl_fetch_key(
+ BackendDB *be,
+ DB *db,
+ DB_TXN *tid,
+ DBT *key,
+ ID *ids )
+{
+ int rc;
+ DBT data;
+
+ assert( ids != NULL );
+
+ DBTzero( &data );
+ data.data = ids;
+ data.ulen = BDB_IDL_SIZE * sizeof( ID );
+ data.flags = DB_DBT_USERMEM;
+
+ /* fetch it */
+ rc = db->get( db, tid, key, &data, 0 );
+
+ return rc;
+}
+
int
bdb_idl_insert_key(
BackendDB *be,
DB *db,
DB_TXN *txn,
struct berval *k,
- ID **idout
+ ID *ids
)
{
- Datum key;
- ID_BLOCK *idl;
+ DBT key;
#ifdef NEW_LOGGING
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
- "key_read: enter\n" ));
+ "key_read: enter\n" ));
#else
Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
#endif
- ldbm_datum_init( key );
- key.dptr = k->bv_val;
- key.dsize = k->bv_len;
+ DBzero( &key );
+ key.data = k->bv_val;
+ key.size = k->bv_len;
- rc = bdb_idl_fetch_key( be, db, key, idl );
+ rc = bdb_idl_fetch_key( be, db, txn, key, ids );
+ if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
- "key_read: %ld candidates\n",
- idl ? ID_BLOCK_NIDS(idl) : 0 ));
+ LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
+ "bdb_key_read: failed (%d)\n",
+ rc ));
#else
- Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n",
- idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read: failed (%d)\n",
+ rc, 0, 0 );
#endif
+ } else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
+ "bdb_key_read: %ld candidates\n",
+ idl ? ID_BLOCK_NIDS(idl) : 0 ));
+#else
+ Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read %ld candidates\n",
+ idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
+#endif
+ }
- *idout = idl;
- return LDAP_SUCCESS;
+ return rc;
}
#endif
*/
unsigned bdb_idl_search( ID *ids, ID id );
+int bdb_idl_fetch_key(
+ BackendDB *be,
+ DB *db,
+ DB_TXN *txn,
+ DBT *key,
+ ID *ids );
+
int bdb_idl_insert_key(
BackendDB *be,
DB *db,