1

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I was just beginning to consider if a cursor was the solution. And it was. Problem solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.