Search code examples
berkeley-db

Retrieving a range of data from Berkeley DB


How can I retrieve a range of data such as 10 < key < 20 from Berkeley DB? I couldn't find anything by searching.


Solution

  • I've taken a quick look at http://pybsddb.sourceforge.net/bsddb3.html , and the following idea looks promising: create a DBCursor object, call its .set method to find key 10, then call its .next method until you reach 20.

    I don't know the details of the C API, but I'd try the same idea: try to create a cursor, and call functions named like set and next on the cursor.