dbTalk Databases Forums  

BerkeleyDB weird db->del problem ?

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss BerkeleyDB weird db->del problem ? in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
shamus
 
Posts: n/a

Default 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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.