dbTalk Databases Forums  

How to implement SQL select in BDB?

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


Discuss How to implement SQL select in BDB? in the comp.databases.berkeley-db forum.



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

Default How to implement SQL select in BDB? - 06-19-2006 , 10:39 AM






I am using BDB to store my data,and associate several secondary DBs to
the primary DB,secondary DB uses btree as access method,now I want to
implement a simple select SQL function like this:
select * from flow where lasttime < 115075860 and lasttime >= 115075800
lasttime is a secondary key, How to accomplish this target in BDB?


Reply With Quote
  #2  
Old   
Florian Weimer
 
Posts: n/a

Default Re: How to implement SQL select in BDB? - 06-19-2006 , 01:00 PM






Quote:
I am using BDB to store my data,and associate several secondary DBs to
the primary DB,secondary DB uses btree as access method,now I want to
implement a simple select SQL function like this:
select * from flow where lasttime < 115075860 and lasttime >= 115075800
lasttime is a secondary key, How to accomplish this target in BDB?
You need to use a cursor and DB_SET_RANGE.


Reply With Quote
  #3  
Old   
chenyajun
 
Posts: n/a

Default Re: How to implement SQL select in BDB? - 06-19-2006 , 10:43 PM



The following SQL contains two compares:
select * from flow where lasttime < 115075860 and lasttime >=
115075800.

It seems that DB_SET_RANGE only fetchs the record that is the smallest
key greater than or equal to the specified key.
Does it mean that it only return a SINGLE record and only implement
just ONLY ONE compare?
Then I need to use cursor and DB_SET_RANGE to return mutiple data sets
and then extract these records and to implement left compares in other
programm language(C,java,etc) manually?


Reply With Quote
  #4  
Old   
Florian Weimer
 
Posts: n/a

Default Re: How to implement SQL select in BDB? - 06-20-2006 , 02:51 PM



Quote:
The following SQL contains two compares:
select * from flow where lasttime < 115075860 and lasttime >=
115075800.

It seems that DB_SET_RANGE only fetchs the record that is the
smallest key greater than or equal to the specified key. Does it
mean that it only return a SINGLE record and only implement just
ONLY ONE compare?
Yes.

Quote:
Then I need to use cursor and DB_SET_RANGE to return mutiple data sets
and then extract these records and to implement left compares in other
programm language(C,java,etc) manually?
Yes, you need to iterate over key/data pairs until you find one whose
key violates the second part of the condition.


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.