Subject Stream BLOB & gbak problem with Firebird RC7/8
Author c_barheine
With Firebird RC7 I am not able to backup a database table containing
a binary stream BLOB (isc_bpb_type: isc_bpb_type_stream).
With RC8 this is possible, but after backing up and restoring the
database, when I do a seek operation (isc_seek_blob), I get error
#335544465 (invalid ARRAY or BLOB operation/invalid BLOB type for
operation).
As I understand it, segmented BLOBs (isc_bpb_type_segmented) provide
sequential access only, so for random access I need stream BLOBs.

Here is a simple test case:

1) CREATE DATABASE 'd:\tmp\blobtest.fdb' USER 'sysdba' PASSWORD
'masterkey' PAGE_SIZE 4096 DEFAULT CHARACTER SET NONE;
2) SET SQL DIALECT 3;
3) CREATE TABLE testtable (streamblob BLOB);
4) Prepare the dynamic SQL statement "INSERT INTO testtable VALUES (?)"
5) Create a blob parameter buffer: char bpb[] = { isc_bpb_version1,
isc_bpb_type, 1, isc_bpb_type_stream }
6) Create the BLOB using isc_create_blob2(..., sizeof(bpb), bpb)
7) Populate the BLOB by making a series of isc_put_segment() calls
8) Close the BLOB and associate its id with the parameter of the
INSERT statement, then execute it.
9) At this point I can reopen the BLOB with the same bpb and
isc_open_blob2(), navigate through it via isc_seek_blob(), and read
portions of it via isc_get_segment() without difficulties in both RC7
and RC8.
10) In RC7, when doing "gbak -b -user sysdba -pass masterkey
d:\tmp\blobtest.fdb d:\tmp\blobtest.fbk" I get the error message
"segment buffer length shorter than expected".
11) In RC8, I can back up and restore the database without error messages.
12) Having done this, I can successfully open the BLOB and read its
contents (unchanged) as before, but now isc_seek_blob() fails with the
above-mentioned error.

I will be most grateful if someone could tell me what I am doing wrong.