请教关于用Delphi5.0中的TQuery向Ms Sql Server7.0保存大图象(即:TBlobStream)?

saipm 2000-06-07 01:25:00
我在Ms Sql Server7.0中有一个表,该表中有Image类型的字段,用TTable通过以下方法写任何的图象(BlobStream)到该字段都没有问题:方法1是用TDBImage直接连接; 方法2是用TBlobStream流的方法进行写.
但是,若将TTable改为TQuery时,小的图象没有问题;然而图象稍大,以上两种方法都提示"Invalid Blob Length"错误! 不知何故,TQuery和TTable还有如此的差异.请教各位,如何解决TQuery的这个问题? (注:考虑到网络效率, 本人只能用TQuery实现读写此Image字段).谢谢了!
...全文
189 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lixq 2000-06-08
  • 打赏
  • 举报
回复
非常感谢蔡兄,有您这样热心的人在,中国的软件就大有希望。
saipm 2000-06-07
  • 打赏
  • 举报
回复
halfdream,zsr:
你们好! 其实, 我是在BDE管理器中设置了BLOB SIZE和BLOB TO CACHE, 只不过设得不够大! 谢谢你们的提醒. 同时也发现这两个设置对Live Table 没有作用. 所以才有"用TTable没有问题, 而TQuery则提示Invalid Blob Length"现象 , 同时, 这也误导了我, 使我以为设置OK! 不过, 我还是不知对设这两个参数多大为好! 因为我发现图象大小为50,60K, 这两个参数要100K以上才行.
lixq 2000-06-07
  • 打赏
  • 举报
回复
我也想知道解决方法。另外,烦请saipm介绍一下您的第二种方法。最好能有代码示例。
mailto:lixqmaster@sina.com。拜托了。
zsr 2000-06-07
  • 打赏
  • 举报
回复
利用Query来查询Blob字段时,如果字段内容较大,需要在BDE的configuration中修改数据库驱动程序的初始值,主要是Blob size 和Blobs to cache两项,一般将前者设为blob字段的可能最大值,后者应大于前者。
halfdream 2000-06-07
  • 打赏
  • 举报
回复
TTable 实质也是通过了SQL,
你用SQL monitor 跟踪一下。
同TQuery 产生的SQL,对比一下,也许能找出问题所在。

另外,数据库连接选项中的Blob Size 的大小设置没有? 它缺省值是32,单位是K。
这是一个基于Delphi XE2的OpenCL控件。其使用到了Khronos Group Inc.的CL.pas单元。 OpenCL的设计思路和OpenGL类似,对于大部分Delphi的设计者来说,非常不习惯,而且使用起来并不十分方便 设计这个TOpenCL控件的目的不是替代OpenCL的原生使用方式,而是为了开发者能够快速对OpenCL进行应用并且可以 用来测试性能和功能。 使用TOpenCL控件,可以象使用数据库控件那样方便的去调用OpenCL程序,不需要太多代码就可以运行一个OpenCL 的Kernel。这对于学习和深入研究OpenCL的性能有一个很好的铺垫。 使用OpenCL做并行计算的一个主要因素就是提高大数据量计算的速度,这和通常的业务处理类程序大不相同,因 此提升OpenCL的运行效率是至关重要的,本控件附带的Demo程序,是对两个长度分别为8192和32的float数组,进行 一维卷积计算的。在选择不同的数据传递方式(如使用显存还是Host内存、使用只读方式还是可读写或者只写方式), 或者不同的Device(如在多核CPU上和GPU上运行Kernel程序)上运行,其效率相差是非常大的。 Demo程序缺省的使用不显示获取结果的方式运行,缺省的数据传输是使用显存(CPU作为Device的时候,其实还 是系统内存)并Copy数据的方式,因此显示结果始终是0。当输出的参数传递方式改为直接使用系统内存指针的方式时, 不使用显示获取计算结果则是可以得到运算结果的。这些参数之间的差异,读者自行测试并仔细体会,通过调整,相信 可以得到最佳的运行方式。 Demo包含了四个Kernel函数,分别是Convolution_Kernel_With_Barrier。这是一个带有同步函数Barrier的卷积 过程,并在卷积完成后,等待所有单元计算完毕,然后对结果进行微分(差商)处理,实际情况表明Barrier函数对GPU 的影响甚微,但如果使用CPU作为Device计算,则效率影响非常大,其耗时几乎和单核计算不相上下,估计是同步函数 在等候的过程,引起了CPU对Catch竞争访问的结果吧。对这种情况,反倒不如拆分成两个Kernel进行单独计算,其累 积的计算时间基本上为两个独立Kernel耗时只和。 Differ_Kernel是单独进行微分计算的,是为了验证上面计算耗时结果的。 Convolution_Kernel是只进行卷积计算的,可以认为和Differ_Kernel前后执行,其结果应该和Convolution_Kerne- l_With_Barrier单独执行是一样的。 Convolution则是一个简单的计算过程,用来测试启动Kernel、等候数据等操作会占用的时间情况的。 OpenCL其实并不是想象那么美妙,也不是想象的那么复杂,但要使用好OpenCL,就必须认真的对待每个细节, 甚至到每一个函数调用或者if控制等,大家可以参考“http://hi.baidu.com/fsword73”,上面涉及到的很多方面,都是 可以提升Kernel运行效率的。 目前这个TOpenCL控件只是作者为了测试OpenCL运行效率编写的一个小的工具,作为一个测试工具或者技术积累阶段 的工具足矣,但在实际工程,希望还是能够尽可能使用原生的调用方式,控件模式势必会带来一定的性能损失的,这是 无法克服的是一个实际情况,对于某些流式数据处理的计算而言,多次重复使用同一个Kernel对流式数据进行处理的,则 使用本控件应该不会造成太大的性能影响。 目前TOpenCL不支持多个Device同时工作,可以选择CPU、GPU或者APU作为首选设备, X86下运行正常,X64下运行仍有 问题,疑和cl.pas对context等处理的方式不支持X64或者其他原因。 目前支持的OpenCL版本为1.2。控件没有考虑OpenCL和OpenGL协同工作的情况,需要做这方面应用或者测试的读者,请 自行处理。 一下是控件几个主要类的引用关系图。供参考。 由于时间的关系,不可能提供详细的使用说明,往谅解,有问题可邮件与作者联系或者QQ联系。 Mail:18909181984@189.cn QQ:57440981 TOpenCL --| | |--TclKernels --| |--- TclKernel --| | |-- TclK
SQL Server Data Access Components 2.45Copyright 1997-2003, Core Lab. All Rights Reserved--------------------------------------------------SQL Server Data Access Components (SDAC) library offers a set ofnonvisual components for Borland Delphi and C++ Builder. They provideaccess to Microsoft SQL Server and are an alternative to a standardway of accessing databases using Borland Database Engine (BDE).SDAC uses OLE DB directly through a set of COM-based interfaces thatexpose data from a variety of sources. OLE DB interfaces provideapplications with uniform access to data stored in diverse informationsources, or data stores. These interfaces support the amount of DBMSfunctionality appropriate to the data store, enabling the data storeto share its data.Using BDE in SQL Server oriented client/server applications has somedeficiencies. In many cases BDE community are unable to employ serverspecific features, they must tolerate excessive usage of resources,reduced speed of processing data, restricted distribution of an applicationand its administration.Using BDE in database applications amounts to the following data pathbetween server and client:[SQL Server] <-> [DBLibrary] <-> [SQL Links] <-> [BDE] <-> [Client application]SDAC works directly through OLE DB, which is a native SQL Serverinterface. Applications with SDAC components access server directly:[SQL Server] <-> [OLE DB] <-> [Client application]Using SQL Server Data Access gives you the following advantages: - No distribution, installation and configuration is required for BDE and ODBC; - You can use any Delphi Professional Edition to develop client/server applications; - Supports SQL Server specific features: windows authentication, metadata, unicode fields, manual refresh for record in a dataset, automatic getting Identity value and results of triggers work and a lot of more; - Simplifies data updating; - Speeds up fetch of records from database; - Provides automatic refresh for records; - Advanced design time editors; - Interface (methods, properties) of SDAC components is similar to those of standard BDE data access components (TDatabase, TQuery, ..); - Supports all data-aware components; - and so on.Compatibility-------------SDAC supports SQL Server 7, SQL Server 2000 and MSDE.SDAC requires OLE DB installed on workstation.Note: in current versions of Microsoft Windows, as Windows 2000, OLE DB is already included as standard package. But it‘s highly recommended to download latest version (newer than 2.5) of Microsoft Data Access Components (MDAC) at http://www.microsoft.com/dataInstallation------------SDAC installer copies these files to folders where they should be resided. sdacXX.bpl - SDAC run-time package (located in WindowsSystem folder) dclsdacXX.bpl - SDAC design-time package (located in DelphiBin folder) sdacvclXX.bpl - VCL support package (located in DelphiBin folder) crcontrolsXX.bpl - TCRDBGrid component (located in DelphiBin folder) Delphi ====== To compile SDAC based application add $(DELPHI)SDACLib to Project Options|Search path. C++ Builder =========== To compile SDAC based application add $(BCB)SDACLib to Project Options|Library path and $(BCB)SDACInclude to Project Options|Include path.Writing GUI applications with SDAC----------------------------------Now SDAC GUI part is standalone. This means that to make available GUI elements such as sql cursors, connect form, connect dialog etc. you should explicitly include SdacVcl unit to your application. This feature is needed for writing console applications. Delphi and C++ Builder ====================== By default SDAC does not require Forms, Controls and another GUI related units. Only TMSConnectDialog component requires Forms unit.Trial version restrictions--------------------------Note following restriction when using SDAC trial version.When SDAC based application is running IDE should be also running.Using several products in one IDE---------------------------------SDAC, ODAC and MyDAC components use common base packages listed below. dacXX.bpl dacvclXX.bpl dcldacXX.bplNote that product compatibility is provided for current build only.In the other words, if you upgrade one of the installed products itmay conflict with older builds of other ones. In order to continue usingproducts simultaneously you should upgrade all of them at the same time.--------------------http://www.crlab.comsdac@crlab.com

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧