goto done;
}
+#ifndef BDB_MULTIPLE_SUFFIXES
if( !be_issuffix( be, &ptr )) {
+#endif
buf[0] = DN_SUBTREE_PREFIX;
- rc = bdb_idl_insert_key( be, db, txn, &key, e->e_id );
+ rc = db->put( db, txn, &key, &data, DB_NOOVERWRITE );
if( rc != 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG ( INDEX, ERR,
- "=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
+ "=> bdb_dn2id_add: subtree (%s) put failed: %d\n",
ptr.bv_val, rc, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "=> bdb_dn2id_add: subtree (%s) insert failed: %d\n",
+ "=> bdb_dn2id_add: subtree (%s) put failed: %d\n",
ptr.bv_val, rc, 0 );
#endif
goto done;
}
+#ifdef BDB_MULTIPLE_SUFFIXES
+ if( !be_issuffix( be, &ptr )) {
+#endif
dnParent( &ptr, &pdn );
key.size = pdn.bv_len + 2;
#endif
goto done;
}
+#ifndef BDB_MULTIPLE_SUFFIXES
}
while( !be_issuffix( be, &ptr )) {
+#else
+ for (;;) {
+#endif
ptr.bv_val[-1] = DN_SUBTREE_PREFIX;
rc = bdb_idl_insert_key( be, db, txn, &key, e->e_id );
#endif
break;
}
+#ifdef BDB_MULTIPLE_SUFFIXES
+ if( be_issuffix( be, &ptr )) break;
+#endif
dnParent( &ptr, &pdn );
key.size = pdn.bv_len + 2;
key.data = pdn.bv_val - 1;
ptr = pdn;
}
+#ifdef BDB_MULTIPLE_SUFFIXES
+ }
+#endif
done:
ch_free( buf );
goto done;
}
+#ifndef BDB_MULTIPLE_SUFFIXES
if( !be_issuffix( be, &ptr )) {
+#endif
buf[0] = DN_SUBTREE_PREFIX;
rc = db->del( db, txn, &key, 0 );
if( rc != 0 ) {
goto done;
}
+#ifdef BDB_MULTIPLE_SUFFIXES
+ if( !be_issuffix( be, &ptr )) {
+#endif
dnParent( &ptr, &pdn );
key.size = pdn.bv_len + 2;
#endif
goto done;
}
+#ifndef BDB_MULTIPLE_SUFFIXES
}
while( !be_issuffix( be, &ptr )) {
+#else
+ for (;;) {
+#endif
ptr.bv_val[-1] = DN_SUBTREE_PREFIX;
rc = bdb_idl_delete_key( be, db, txn, &key, e->e_id );
#endif
goto done;
}
+#ifdef BDB_MULTIPLE_SUFFIXES
+ if( be_issuffix( be, &ptr )) break;
+#endif
dnParent( &ptr, &pdn );
key.size = pdn.bv_len + 2;
key.data = pdn.bv_val - 1;
ptr = pdn;
}
+#ifdef BDB_MULTIPLE_SUFFIXES
+ }
+#endif
done:
ch_free( buf );
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2idl( \"%s\" )\n", dn->bv_val, 0, 0 );
#endif
+#ifndef BDB_MULTIPLE_SUFFIXES
if (prefix == DN_SUBTREE_PREFIX && be_issuffix(be, dn))
{
BDB_IDL_ALL(bdb, ids);
return 0;
}
+#endif
DBTzero( &key );
key.size = dn->bv_len + 2;
be->be_suffix[0].bv_val, 0, 0 );
#endif
+#ifndef BDB_MULTIPLE_SUFFIXES
+ if ( be->be_suffix[1].bv_val ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACK_BDB, ARGS,
+ "bdb_db_open: only one suffix allowed\n", 0, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ARGS,
+ "bdb_db_open: only one suffix allowed\n", 0, 0, 0 );
+#endif
+ return -1;
+ }
+#endif
/* we should check existance of dbenv_home and db_directory */
rc = db_env_create( &bdb->bi_dbenv, 0 );