Subject Re: [firebird-support] dsql_execute2 and udf with blob input parameter
Author Dimitry Sibiryakov
> Firebird v2.1.3 (also found on v2.1.2).

It seems that all versions are affected.

> Executing this statement:
>
> SELECT ( UDF_PROCESS_BLOB( ? ) ) AS TEST_RESULT
> FROM RDB$DATABASE
>
> fails with:
> Error 335544358: message length error (encountered 4, expected 12)
>
> The error occurs from the return code after calling
> dsql_execute2 (all the previous prepare/describe/blob api
> calls seemed to have completed without error).

No. isc_dsql_describe_bind returned sqllen for the parameter == 0.
Thus the error on execute - generated BLR doesn't contain expected
ISC_QUAD (8 bytes).

> Is anyone able to guess from the information given whether
> this is really a bug in FB v2.1... or whether I am missing
> something?

This is a bug. Until the fix, you can try to workaround it applying
this statement to database:

UPDATE RDB$FUNCTION_PARAMETERS SET RDB$FIELD_LENGTH=8 WHERE
RDB$FIELD_TYPE=261;

I think that must be enough to make your select statement above working.

SY, SD.