ODBC迭代表而不存储在内存中
我需要一种方法来迭代数据库表,而无需将其实际存储在内存中的任何位置。我想本质上像输入迭代器一样读取行。
我尝试过将游标与 select 语句一起使用(select * from table_name),但这会检索整个表并将其反馈为一次一行。所以这个解决方案不好。相反,我需要它只在我要求的时候为我提供每一行。
非常感谢任何建议。
谢谢!
I need to have a way to iterate through a database table without actually storing it in memory anywhere. I want to essentially read through the rows like an input iterator.
I've tried using cursors with a select statement (select * from table_name), but this retrieves the entire table and feeds it back to be one row at a time. So this solution is no good. Instead, I need it to only feed me each row as I ask for it.
Any suggestions are greatly appreciated.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只想使用仅向前游标。您的数据库需要支持这一点。有关详细信息,请参阅 MSDN 的如何:使用光标。
如果您如果使用 SQL Server,您可以使用 仅快进光标 ,这提供了额外的好处。
You'll just want to use a forward only cursor. Your DB will need to support this. For detials, see MSDN's How to: Use Cursors.
If you're using SQL Server, you can use a Fast Forward-Only Cursor, which provides extra benefits.