Subject Re: AW: [IBO] Large BLOB download
Author Geoff Worboys
Maik Wojcieszak mw@... [IBObjects] wrote:
> 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
> ...

That would do it. :-)

> 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.

You can check whether any field is NULL by using the TIB_Column
IsNull method. So...

if Fields[0].IsNull then

or you might prefer:
if Fields[0].IsNotNull then

Also available on TIB_Column, but only useful with blob and
array columns is:

if Fields[0].IsLoaded then
// stuff it's safe to do with an already loaded blob

And there's also this one:

if Fields[0].BlobSize >= 0 then
// the blob may not be loaded but we can do stuff
// based on its size

For non-blob fields the BlobSize always returns -1, for blob
fields it will do this:
if IsLoaded then
read the size from the stream
use the BlobInfo API to get the size
WITHOUT actually loading the blob

So BlobSize can be a very useful thing to know about when
dealing with blobs that might be very large. :-)

There's lots more, I suggest you look at the documentation, or
do what I do and browse the interface code in the source, all
the documentation is there and there's lots of stuff that you
will never know you needed until you read about them. ;-)

> 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.

I understand. I'm still working with a product that I wrote
15 years ago (well, that's when v1 was released, so some of the
code is even older). I know lots more now than I did then, and
there is much I would do differently if I rewrote it now.

Geoff Worboys
Telesis Computing Pty Ltd