ODBC迭代表而不存储在内存中

发布于 2024-08-14 07:30:22 字数 199 浏览 4 评论 0原文

我需要一种方法来迭代数据库表,而无需将其实际存储在内存中的任何位置。我想本质上像输入迭代器一样读取行。

我尝试过将游标与 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怀里藏娇 2024-08-21 07:30:22

您只想使用仅向前游标。您的数据库需要支持这一点。有关详细信息,请参阅 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文