dbTalk Databases Forums  

Dbc.get: positionning a cursor versus positioning and getting data from a cursor

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


Discuss Dbc.get: positionning a cursor versus positioning and getting data from a cursor in the comp.databases.berkeley-db forum.



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

Default Dbc.get: positionning a cursor versus positioning and getting data from a cursor - 09-28-2003 , 12:55 PM






Hi

The BerkeleyDB documentation for Dbc.get with DB_SET_RANGE flag states
that:

Db.DB_SET_RANGE
The Db.DB_SET_RANGE flag is identical to the Db.DB_SET flag, except
that in the case of the Btree access method, the key is returned as
well as the data item and the returned key/data pair is the smallest
key greater than or equal to the specified key (as determined by the
comparison method), permitting partial key matches and range searches.


So, in my understanding, the DB_SET_RANGE combines two functions in
the same call:

1/ It positions the cursor on the smallest key greater that or equal
to the specified key.

2/ It returns also the key/data corresponding to the relevant key AND
advances the cursor to the next key.


It there a way with DBD to have each function in separate calls i.e,

First call: having Dbc.get(Db.SET_RANGE) to only position the cursor
without returning the key/data AND NOT advancing the cursor to the
next key (one call)

Second call: and let the Dbc.get(Db.DB_NEXT) getting the key/data and
avancing the cursor (one call)???


Regards

Francis ANDRE

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

Default Re: Dbc.get: positionning a cursor versus positioning and getting data from a cursor - 09-28-2003 , 04:14 PM







"Francis ANDRE" <francis.andre (AT) easynet (DOT) fr> wrote

Quote:
Hi

The BerkeleyDB documentation for Dbc.get with DB_SET_RANGE flag states
that:

Db.DB_SET_RANGE
The Db.DB_SET_RANGE flag is identical to the Db.DB_SET flag, except
that in the case of the Btree access method, the key is returned as
well as the data item and the returned key/data pair is the smallest
key greater than or equal to the specified key (as determined by the
comparison method), permitting partial key matches and range searches.


So, in my understanding, the DB_SET_RANGE combines two functions in
the same call:

1/ It positions the cursor on the smallest key greater that or equal
to the specified key.

2/ It returns also the key/data corresponding to the relevant key AND
advances the cursor to the next key.

Where did you read that the cursor advances to the next key?
I believe it does NOT. The cursor should remain on the same key/data pair
that it returns.

--Sarge

Quote:
It there a way with DBD to have each function in separate calls i.e,

First call: having Dbc.get(Db.SET_RANGE) to only position the cursor
without returning the key/data AND NOT advancing the cursor to the
next key (one call)

Second call: and let the Dbc.get(Db.DB_NEXT) getting the key/data and
avancing the cursor (one call)???


Regards

Francis ANDRE



Reply With Quote
  #3  
Old   
Keith Bostic
 
Posts: n/a

Default Re: Dbc.get: positionning a cursor versus positioning and getting data from a cursor - 09-28-2003 , 08:46 PM



francis.andre (AT) easynet (DOT) fr (Francis ANDRE) wrote in message news:<52c6cf6f.0309280955.662a82e3 (AT) posting (DOT) google.com>...
Quote:
So, in my understanding, the DB_SET_RANGE combines two functions in
the same call:

1/ It positions the cursor on the smallest key greater that or equal
to the specified key.

2/ It returns also the key/data corresponding to the relevant key AND
advances the cursor to the next key.
DB_SET_RANGE returns the selected key/data pair, but does not
advance the cursor to the next key/data set beyond that pair.

Regards,
--keith

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Keith Bostic bostic (AT) sleepycat (DOT) com
Sleepycat Software Inc. keithbosticim (ymsgid)
118 Tower Rd. +1-781-259-3139
Lincoln, MA 01773 http://www.sleepycat.com


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.