Subject AW: [IBO] Large BLOB download
Author Maik Wojcieszak
Thank you for your help Geoff,

I'm using TIB_Query here.

The BLOB was loaded into memory when I tried to check if there is a BLOB:

If Field[0].AsVariant = Null then
...

Now I'm using a trigger to set/reset a Boolean field on update of the BLOB field to indicate if the BLOB has data.
Maybe there is another (better) way to check if the BLOB has data.

I appreciate the classes in IBObject. The code in my software is created over more than 10 years now using IBObjects.
From time to time I had to hack around to solve problems that where not working as I expected it.

Cheers,
Maik

-----Urspr√ľngliche Nachricht-----
Von: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Gesendet: Mittwoch, 22. Oktober 2014 10:23
An: IBObjects@yahoogroups.com
Betreff: Re: [IBO] Large BLOB download

Maik Wojcieszak mw@... [IBObjects] wrote:
> I'm trying to download a huge blob, about 250MB, from the firebird
> database with IBObjects.
>
> It seems the TIBQuery object is loading the BLOB data as soon as I
> open it.

Are we talking TIB_Query or TIBOQuery?

Not that it probably matters in this case (although I'm less familiar with TIBOQuery). Is there any chance you have a component connected to the field that is loading it?

In general, IBO doesn't load a blob until something requests it (I rely on this behaviour).

If you don't see obvious reasons in your own code, then put in breakpoints so that you can see the callstack in Delphi and see what is calling it. ... Lots of possibilities for a breakpoint, the easiest might be in IB_Session.pas at the start of: TIB_SessionBase.SysGetBlobData or you could try: TIB_Statement.CreateBlobStream



Also, instead of playing with SQLVAR directly, use IBO's classes. So not this:

blobid := pisc_quad(DS.Fields[0].PSQLVAR^.sqldata)^;

but this:

blobid := TIB_ColumnBlob(DS.Fields[0]).BlobID;

Again, this is unlikely to be a cause of the problem, but it is bad form to go looking at the technical detail unnecessarily We put classes around things to try and hide all that.

--
Geoff Worboys
Telesis Computing Pty Ltd



------------------------------------

------------------------------------

___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
http://tracker.ibobjects.com - your portal to submit and monitor bug reports
http://community.ibobjects.com - your portal to purchase and upgrade
------------------------------------

Yahoo Groups Links