data.size = 2 * sizeof( ID );
} else if ( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_idl_insert_key: get failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
return rc;
} else if ( data.size == 0 || data.size % sizeof( ID ) ) {
/* size not multiple of ID size */
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_idl_insert_key: odd size: expected %ld multiple, got %ld\n",
+ (long) sizeof( ID ), (long) data.size, 0 );
return -1;
} else if ( BDB_IS_ALLIDS(ids) ) {
} else if ( data.size != (1 + ids[0]) * sizeof( ID ) ) {
/* size mismatch */
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_idl_insert_key: get size mismatch: expected %ld, got %ld\n",
+ (long) ((1 + ids[0]) * sizeof( ID )), (long) data.size, 0 );
return -1;
} else {
/* store the key */
rc = db->put( db, tid, key, &data, 0 );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_idl_insert_key: get failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ }
return rc;
}
rc = db->get( db, tid, key, &data, DB_RMW );
if ( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_idl_delete_key: get failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
return rc;
} else if ( data.size == 0 || data.size % sizeof( ID ) ) {
/* size not multiple of ID size */
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_idl_delete_key: odd size: expected %ld multiple, got %ld\n",
+ (long) sizeof( ID ), (long) data.size, 0 );
return -1;
} else if ( BDB_IS_ALLIDS(ids) ) {
} else if ( data.size != (1 + ids[0]) * sizeof( ID ) ) {
/* size mismatch */
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_idl_delete_key: get size mismatch: expected %ld, got %ld\n",
+ (long) ((1 + ids[0]) * sizeof( ID )), (long) data.size, 0 );
return -1;
} else {
if( BDB_IS_ALLIDS(ids) ) {
/* delete the key */
rc = db->del( db, tid, key, 0 );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_idl_delete_key: delete failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ }
return rc;
}
/* store the key */
rc = db->put( db, tid, key, &data, 0 );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_idl_delete_key: put failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ }
+
return rc;
}