]> git.sur5r.net Git - openldap/commitdiff
Minor fixes for BDB_IDL_MULTI
authorHoward Chu <hyc@openldap.org>
Fri, 7 Dec 2001 06:48:38 +0000 (06:48 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 7 Dec 2001 06:48:38 +0000 (06:48 +0000)
servers/slapd/back-bdb/idl.c
servers/slapd/back-bdb/init.c

index 37848f09a03f80fc61b5ee1a7dc0d7370604009d..ef0889b0d71728931ac73b09c41eea15e6fe8b27 100644 (file)
@@ -319,6 +319,8 @@ bdb_idl_insert_key(
        data.data = &id;
        data.size = sizeof(id);
        data.flags = DB_DBT_USERMEM;
+
+       rc = db->put( db, tid, key, &data, DB_NODUPDATA );
 #else
        data.data = ids;
        data.ulen = sizeof ids;
@@ -379,11 +381,10 @@ bdb_idl_insert_key(
 
                data.size = BDB_IDL_SIZEOF( ids );
        }
-#endif
 
        /* store the key */
        rc = db->put( db, tid, key, &data, 0 );
-
+#endif
        if( rc == DB_KEYEXIST ) rc = 0;
 
        if( rc != 0 ) {
@@ -429,7 +430,8 @@ bdb_idl_delete_key(
                rc = db->cursor( db, tid, &cursor, bdb->bi_db_opflags );
                rc = cursor->c_get( cursor, key, &data, bdb->bi_db_opflags |
                        DB_GET_BOTH | DB_RMW  );
-               rc = cursor->c_del( cursor, 0 );
+               if (rc == 0)
+                       rc = cursor->c_del( cursor, 0 );
                rc = cursor->c_close( cursor );
        }
 #else
index d57b4a875686e3f382cc3c6f19706d496165cfea..66eb7ce861224179808d6f7940a90b224a83dd4a 100644 (file)
@@ -245,6 +245,13 @@ bdb_db_open( BackendDB *be )
                        rc = db->bdi_db->set_bt_compare( db->bdi_db,
                                bdb_bt_compare );
                }
+#ifdef BDB_IDL_MULTI
+               if( i == BDB_DN2ID ) {
+                       rc = db->bdi_db->set_flags( db->bdi_db, DB_DUPSORT );
+                       rc = db->bdi_db->set_dup_compare( db->bdi_db,
+                               bdb_bt_compare );
+               }
+#endif
                rc = db->bdi_db->set_pagesize( db->bdi_db, BDB_PAGESIZE );
 
                rc = db->bdi_db->open( db->bdi_db,