在 SELECT 中拆分 varbinary

发布于 2024-07-12 09:29:33 字数 104 浏览 2 评论 0原文

我的一个表中有一个很大的 varbinary 字段,我想分部分下载以在我的应用程序中显示下载进度指示器。

如何拆分 SELECT 查询中发送的数据?

谢谢

I have a large varbinary field in one of my tables, and I would like to download in parts for show a download progress indicator in my application.

How can I split the data sent in a SELECT query?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

孤寂小茶 2024-07-19 09:29:33

您只需使用 SQLGetData ODBC 调用即可完成此操作。 如果您提供的缓冲区大小小于 varbinary 总大小,它将填充缓冲区并返回 SQL_SUCCESS_WITH_INFO 和 SQLSTATE 01004。如果再次调用它,它将返回下一段数据。 您只需重复操作,直到检索到所有数据。 要以百分比形式了解您的进度,您可以选择长度作为另一列。

请参阅此处,了解有关获取长数据。

You can do this with just the SQLGetData ODBC call. If the buffer size you provide is smaller than the total varbinary size, it will fill the buffer and return SQL_SUCCESS_WITH_INFO and and SQLSTATE 01004. If you call it again, it will return the next segment of data. You just repeat until all the data is retrieved. To know your progress as a percentage, you may be able to select the length as another column.

See here for lots of tips for getting long data.

瑾兮 2024-07-19 09:29:33

请参阅 SqlDataReader.GetBytes 和 CommandBehavior顺序访问。

它将允许您通过多次调用读取 varbinary(max) 。 然后您可以显示呼叫之间的进度。

对于 ODBC,请参阅 ISequentialStream此处也),您也可以分块阅读。

See SqlDataReader.GetBytes and CommandBehavior SequentialAccess.

It will allow you to read from a varbinary(max) with multiple calls. Then you can display progress between calls.

For ODBC see ISequentialStream (here as well), you can also read it in chunks.

往昔成烟 2024-07-19 09:29:33

我在 C++ 应用程序中使用 ODBC 和 Qt4。 我想我需要在 SELECT 语句中拆分数据才能实现此目的。

不管怎么说,还是要谢谢你。

I'm using ODBC with Qt4 in a C++ application. I think I need to split the data in a SELECT Statement to achieve this.

Thanks anyway.

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