Use DB_NODUPDATA when adding IDs. Silence log for DB_NOTFOUND in delete_key,

let caller log it if they care.
This commit is contained in:
Howard Chu 2002-08-30 11:37:43 +00:00
parent 9d4f5e13e8
commit 4a3a557827

View File

@ -572,7 +572,7 @@ bdb_idl_insert_key(
} }
} else if ( rc == DB_NOTFOUND ) { } else if ( rc == DB_NOTFOUND ) {
put1: data.data = &id; put1: data.data = &id;
rc = cursor->c_put( cursor, key, &data, DB_KEYFIRST ); rc = cursor->c_put( cursor, key, &data, DB_NODUPDATA );
/* Don't worry if it's already there */ /* Don't worry if it's already there */
if ( rc != 0 && rc != DB_KEYEXIST ) { if ( rc != 0 && rc != DB_KEYEXIST ) {
err = "c_put id"; err = "c_put id";
@ -827,6 +827,7 @@ bdb_idl_delete_key(
} else { } else {
/* initial c_get failed, nothing was done */ /* initial c_get failed, nothing was done */
fail: fail:
if ( rc != DB_NOTFOUND ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG( INDEX, ERR, LDAP_LOG( INDEX, ERR,
"bdb_idl_delete_key: %s failed: %s (%d)\n", "bdb_idl_delete_key: %s failed: %s (%d)\n",
@ -835,6 +836,7 @@ fail:
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: " Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
"%s failed: %s (%d)\n", err, db_strerror(rc), rc ); "%s failed: %s (%d)\n", err, db_strerror(rc), rc );
#endif #endif
}
cursor->c_close( cursor ); cursor->c_close( cursor );
return rc; return rc;
} }