dbTalk Databases Forums  

Longest matching prefix lookups

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


Discuss Longest matching prefix lookups in the comp.databases.berkeley-db forum.



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

Default Longest matching prefix lookups - 07-23-2005 , 06:04 AM






Does Berkeley DB support a lookup method on BTREE databases which
returns the key/data pair whose key is a prefix of the lookup key, and
the longest key with this property?

Maybe I'm missing something and this can be implemented using a
special user-defined comparison function?

(Yes, this is the IP forwarding problem, but it does show up in other
contexts, too. 8-)

Reply With Quote
  #2  
Old   
Bruman99se
 
Posts: n/a

Default Re: Longest matching prefix lookups - 07-23-2005 , 08:47 AM






Hi There,
I am not sure if this is quite what you are looking for....but you
can use the SETRANGE feature of a cursor together with a special
comparitor to do partial matches. This would allow you to search
through all matches only of a particular prefix match (defined by your
comparitor). It would then be up to you to decide which of the
matching keys within the returned range is the one you were looking
for.

http://www.sleepycat.com/docs/api_cxx/dbc_get.html

Sorry if this is off-base from your question. Its the only thing that
I am aware of that comes close.

-Greg

Florian Weimer wrote:
Quote:
Does Berkeley DB support a lookup method on BTREE databases which
returns the key/data pair whose key is a prefix of the lookup key, and
the longest key with this property?

Maybe I'm missing something and this can be implemented using a
special user-defined comparison function?

(Yes, this is the IP forwarding problem, but it does show up in other
contexts, too. 8-)


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 - 2013, Jelsoft Enterprises Ltd.