使用 Visual C++ 在 MS SQL 中读取和写入 BLOB 数据和 OLE DB

发布于 2024-10-02 05:40:11 字数 90 浏览 0 评论 0原文

你能帮我吗?我正在寻找如何在 MS SQL Server 2008 中插入和从 BLOB 获取数据的示例。 我正在使用 OLE DB 和 Visual C++。 谢谢

ca you help me? I am looking for example how to insert and get data from BLOB in MS SQL Server 2008.
I am using OLE DB and Visual C++.
Thanks

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

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

发布评论

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

评论(1

风筝有风,海豚有海 2024-10-09 05:40:12

这里有关于该主题的详细信息(无论如何是写入方面):使用 IROWSETFASTLOAD 和 ISEQUENTIALSTREAM 将 BLOB 数据发送到 SQL SERVER

大多数可用样本也
简单化并且不展示
改变每行的数据长度或使用
ISequentialStream。在此示例中,
您将同时看到这两种技术
源文件。默认情况下,样本
演示如何使用 IRowsetFastLoad
每行发送可变长度 BLOB 数据
使用内联绑定。在这种情况下,
内联 BLOB 数据必须适合
可用内存。这个方法有
BLOB 数据时性能更好
是几个字节到几MB,因为
没有额外的流
开销。对于较大的数据,尤其是
其中数据不一定是全部
在一个块中立即可用,
流媒体是更好的选择。

对于回读,MSDN 上有背景和示例代码 此处

SQL Server 本机客户端 OLE DB
提供者不检索大数据
从 SQL Server 直到请求执行
所以由消费者。消费者
应该将所有短数据绑定在一个中
访问器,然后使用一个或多个
用于检索大的临时访问器
所需的数据值。

There's detailed info on that topic (the write side anyway) here: Sending BLOB Data to SQL SERVER Using IROWSETFASTLOAD and ISEQUENTIALSTREAM.

Most of the available samples are too
simplistic and don’t demonstrate
varying data length per row or using
ISequentialStream. In this sample,
you'll see both techniques in one
source file. By default, the sample
shows how to use IRowsetFastLoad to
send variable length BLOB data per row
using in-line bindings. In this case,
the in-line BLOB data must fit in
available memory. This method has
better performance when the BLOB data
is a few bytes to a few MB, because
there is no additional stream
overhead. For larger data, especially
where the data is not necessarily all
available at once in a block,
streaming is a better choice.

For readback there is background and sample code on MSDN here.

The SQL Server Native Client OLE DB
provider does not retrieve large data
from SQL Server until requested to do
so by the consumer. The consumer
should bind all short data in one
accessor, and then use one or more
temporary accessors to retrieve large
data values as required.

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