Subject Using BLOB SUB_TYPE 1 as parameter
Author Roman Rokytskyy
Hi,

Originally this problem was reported in Firebird-Java. We have found
that following statement fails (test case had different metadata, but
I think this is not very important here):

SELECT blob_field FROM test_table WHERE blob_field = ?

Table is defined as CREATE TABLE test_table(blob_field BLOB SUB_TYPE 1).

JayBird' algorithm for executing this statement can be described as
following:

1. isc_dsq_prepare(...) // prepare statement
2. isc_create_blob2 // create blob that will be used as param value
3. isc_put_segment // fill parameter value
4. set id of that blob into out_sqlda
5. isc_dsql_execute2
6. isc_dsql_fetch

At this point we get "internal error" (error code 335544384,
isc_badblk) from the server.

Question: what is wrong with this code? How do I prepare statement
with condition that involves comparison with BLOB SUB_TYPE 1 column?
(btw, if we replace "?" with string constant, like, 'abc', everything
is fine).

Thank you in advance for any hints.

Best regards,
Roman Rokytskyy