dbTalk Databases Forums  

About Sort

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


Discuss About Sort in the comp.databases.berkeley-db forum.



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

Default About Sort - 07-15-2007 , 09:09 PM






Hi all,

I built a secondary index with a custom sort function. It works well
(I can traverse the index by the sort order). However, I wonder how to
traverse the index by a reverse order.

Is it possible?

Thanks.


Reply With Quote
  #2  
Old   
Don Anderson
 
Posts: n/a

Default Re: About Sort - 07-16-2007 , 08:12 PM






On Jul 15, 10:09 pm, gibeon <gibeon... (AT) gmail (DOT) com> wrote:
Quote:
Hi all,

I built a secondary index with a custom sort function. It works well
(I can traverse the index by the sort order). However, I wonder how to
traverse the index by a reverse order.

Is it possible?

Thanks.
Sure. If you are using the C or C++ API, then you
are already using DB->cursor() to get a cursor and iterate using
the DB_NEXT flag. (right?) To go in reverse, you use DB_PREV
instead of DB_NEXT.

Don't be tempted to change the custom sort function.

- Don



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.