|Subject||Re: [firebird-support] Fixed-length strings in UDFs (Re: Slight UDF Mystery . . .)|
> I have been trying to do that, too. Even if I set the return value toThere used to be a bug when returning binary data from UDF, but it was fixed in FB1.5,
> CHAR(16), Firebird (Version 184.108.40.20610) treats it as a
> null-terminated CSTRING so that the information after a zero byte is lost.
so both FB1.5 and FB2 can return binary zero in CHAR() parameter without problems.
How do you know that data after zero are lost ?
Perhaps you are using buggy components ?
You can create string containing zero byte using ordinary sql statement
SELECT 'A' || CAST('' AS CHAR(1) CHARACTER SET OCTETS) || 'B'
(which will return three characters string with zero byte on second position)
When you run this statement using standard ISQL tool you get
When you run it using my FSQL tool (from http://www.volny.cz/iprenosil/interbase/) you get
(for display purposes it converts zero byte to '.')
As you can see, there is bug in ISQL. I just tested UDF and it returns zero byte
and characters after it just fine.