Subject Re: [Firebird-Java] FBBlobField.java.patch
Author Roman Rokytskyy
> Question about "gdsHelper.getBlobSegment(blob, bufferlength)" and FB
> API - if is returns buffer smaller than the requested length does that
> mean that there is no more data ?

No, the fetched length must be 0.

> Are Firebird BLOBs still segemented or they are streamed now ?

They are of the type they were created. If created from Java application
they are segmented by default, you can create stream BLOBs by specifying
corresponding property (useStreamBlobs).

> If yes, than the way to go is to bypass InputStream and implement
> getBytes() directly through these calls. If returned buffer is smaller
> than the requested size - it is small BLOB and returned buffer should
> be returned to the user directly, else request BLOB length, allocate
> the whole BLOB buffer and read it all.
>
> Is this possible ?

What for? You can use ResultSet.getBlob() method and use Blob.read()
methods - you have no overhead compared to current implementation of the
AbstractJavaGDSImpl.iscGetSegment(...) method regarding memory allocation
and this is still plain JDBC. Method will return you data from the internal
buffer without blocking. Otherwise use FirebirdBlob.readFully(...).

> And one more question: is it possible for getBlobSegment() to read
> data to the specified buffer ? I do not want multiple additional 16k
> buffers to be allocated.

Not yet, but we can add this feature in next point release.

Roman