syker
syker

Reputation: 11272

Iterate through Two Berkeley DBs

How do I iterate over two Berkeley DBs at the same time, advancing a cursor where appropriate (ex: the keys in one db is less than the other) in Perl?

Upvotes: 2

Views: 309

Answers (1)

dsegleau
dsegleau

Reputation: 1980

I'm not 100% sure what you're trying to do, but my suggestion would be to open two separate cursors, let's call them A and B. I'm assuming A is the outer iteration and B is the inner iteration. Start by iterating on cursor A (set the initial cursor location and go into your "getnext" loop). For each record that you get from A, set the initial cursor position for cursor B and iterate until you've seen the records that you want from B. Then advance to the next A, lather, rinse and repeat.

You might also want to ask this question (with a few more details) on the Berkeley DB forum.

Upvotes: 1

Related Questions