迭代两个 Berkeley DB
如何在 Perl 中同时迭代两个 Berkeley DB,在适当的位置推进游标(例如:一个数据库中的键小于另一个数据库中的键)?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是 100% 确定您要做什么,但我的建议是打开两个单独的游标,我们称它们为 A 和 B。我假设 A 是外部迭代,B 是内部迭代。首先迭代光标 A(设置初始光标位置并进入“getnext”循环)。对于从 A 获得的每条记录,设置光标 B 的初始光标位置并迭代,直到看到您想要从 B 获得的记录。然后前进到下一个 A,起泡沫、冲洗并重复。
您可能还想在 Berkeley DB 上询问这个问题(还有更多详细信息)论坛。
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.