BerkeleyDB weird db->del problem ? -
03-09-2006
, 05:09 PM
Check out this PERL code using BerkeleyDB:
unless ($wo = $dbhand->db_get($key, $data)) {
if (open FH, "> $key ") {print FH $data; close(FH);}
$status = $dbhand->db_del($key); # SILENTLY FAILS !
if ($status) {print "FAIL";} else {print "SUCCESS";}
}
Line-1 succeeds, because the result is written out to FH in line-2.
Line-3 FAILS? But line-4 yields "SUCCESS"?
When I check the $dbhand-file, the db $key record is still there! I
have been using a set of Berkeley DB files for about a year with perl's
BerkeleyDB. db->del has worked perfectly before on other files in the
set. I can verify that the file I am listing/viewing after running the
above code is the SAME ONE the code executes on. Prior to that
delete-code, an overwrite of another record in the same db-file works.
I have added a '$dbhand->sync()' and 'undef $dbhand' after the above
code, but to no avail! I cannot for the life of me think what might be
wrong -- (but this is the first attempt to delete records from that
particular db-file) ?
HELP!!! Any ideas anyone?
shamus |