Subject | Re: [firebird-support] Fixed-length strings in UDFs (Re: Slight UDF Mystery . . .) |
---|---|
Author | Ivan Prenosil |
Post date | 2006-07-21T09:35:01Z |
> 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 2.0.0.12710) 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'
FROM RDB$DATABASE;
(which will return three characters string with zero byte on second position)
When you run this statement using standard ISQL tool you get
CONCATENATION
=============
A
When you run it using my FSQL tool (from http://www.volny.cz/iprenosil/interbase/) you get
CONCATENATION
=============
A.B
(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.
Ivan