Subject Re: [Firebird-Java] BLOBs
Author unordained
---------- Original Message -----------
From: "Steffen Heil" <lists@...>
> 2) I need to load some blobs of a big table, but not all. Whether I
> want to read a certain block depends on other values in the same row.
> Can I just do something like this: select value1, value2, blob from ....
> and
> if ( resultSet.getInt( "value1" ) == 3 )
> return resultSet.getBytes( "blob" );
>
> Now I am a little concerned that this results in fetching all blobs
> from the server. Is this correct? Or are only the those blobs fetched
> that I actually get() ? Or do I have to select only the other values
> and then open another statement especially for the blobs I am
> interested in?
------- End of Original Message -------

I'm no authority, but in general, Firebird only sends back blob id's during
primary select, and then fetches each blob you request individually. So
conditionally requesting it should do what you want.

As to the other question, I don't know. If nothing else, can you return an extra
field?

select ... , case when my_blob is null then 0 else 1 end as have_blob ...

-Philip