Subject reading blob from table
Author Hamish Moffatt
Hi,

I am using fdb 0.9.9 and Firebird 2.1 and I trying to fetch some data
out of tables containing blobs. However the blobs I get back are always
truncated at the first null.


One such table is defined as

SQL> show table g_mididrum;
DRUM_NUMBER INTEGER Not Null
DRUM_NAME (DOM_MIDI_NAME) VARCHAR(30) Nullable
DRUM_WAVE BLOB segment 80, subtype BINARY
CHARACTER SET NONE Nullable
DRUM_WAVE_6 BLOB segment 80, subtype BINARY
CHARACTER SET NONE Nullable
DRUM_WAVE_12 BLOB segment 80, subtype BINARY
CHARACTER SET NONE Nullable
CONSTRAINT PK_G_MIDIDRUM:
Primary key (DRUM_NUMBER)

I'm making the query "SELECT * FROM G_MIDIDRUM". The cursor's
description field after the query says

(('DRUM_NUMBER', <type 'int'>, 11, 4, 0, 0, False), ('DRUM_NAME', <type
'str'>, 120, 120, 0, 0, True), ('DRUM_WAVE', <type 'str'>, 0, 8, 0, 0,
True), ('DRUM_WAVE_6', <type 'str'>, 0, 8, 0, 0, True), ('DRUM_WAVE_12',
<type 'str'>, 0, 8, 0, 0, True))

The data in DRUM_WAVE (for example) is coming back as a string with
len() of only 6 or 7 octets. However if I ask firebird to select the
OCTET_LENGTH(DRUM_WAVE), it tells me the real length which are all 7000
bytes up to >128k.

I tried using stream blob mode on this column, I get a BlobReader, and
when I read() all the data from it I still only get 6 or 7 octets.

The connection charset is "UTF8".

I got the same effect in kinterbasdb. We access this table from a C++/Qt
app with the same query ok though. Can you point out my mistake?



thanks
Hamish