Iterate through Two Berkeley DBs
How do I i开发者_高级运维terate 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?
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.
精彩评论