Reputation: 11
The C++ API for Berkeley DB seems straightforward enough except I can't find how to just list all the contained key/value pairs. Did I miss this in the docs ? Does anybody have an example ?
I read the official Berkeley DB docs.
Upvotes: 1
Views: 515
Reputation: 3206
What you want is a database cursor. Think of it as a needle on a record, or indeed, as a cursor on the screen in a text editor. You set up a key that describes where the database should drop the needle (the cursor). You then move the cursor forward or backward through the records, retrieving each one in turn.
There's an example in the tutorial section of the BDB Reference Guide for the C API that shows how to open a cursor and walk through the database with c_get
: https://docs.oracle.com/database/bdb181/html/programmer_reference/am_cursor.html#am_curget
Once you see how it's done in C, you'll be able to translate it to the C++ API.
Upvotes: 1