dbTalk Databases Forums  

Creating a dictionary with BDB

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


Discuss Creating a dictionary with BDB in the comp.databases.berkeley-db forum.



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

Default Creating a dictionary with BDB - 09-25-2006 , 01:04 PM






Hi all!

The "problem" is the following: I've to create a dictionary of some
values stored in a file. It means read the file line by line and assign
a progressive number to each different seen value. When the value is
assigned I've to use it for other things, so I need to know the
assigned number.

I've used the BDB. The values read from the value are the keys of the
eventually new records, the corresponding data is the assigned number.
If I read an already seen line I have already a recod with that key,
and so the corresponding number. Else I insert a new record with the
read line as key and the actual value of a counter as data. In the
latter case I'll know the assigned value while in the former case I
will have to perform a new search over the DB (get method) to get the
already assigned value.

It would be nice if the putNoOverwrite method would returns the
corresponding value in case of an already present key avoiding the
second search. If this is possible, I'll use the search performed by
the putNoOverwrite method optimizing the task.

Is there a way to do this?

I guess that this will improve the performance of my loop (I've to
build the dictionary over millions of value).

Thanks!


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.