Subject Re: [firebird-support] Re: Slight UDF Mystery . . .
Author Ivan Prenosil
> From: "i5cvalde" <cvalde@...>:
> <Ivan.Prenosil@s...> wrote:
> > After quick test, it *seems* that returning CHARs (including binary
> > zero) works in FB1.5.2. But I'm puzzled, because there is no mention
> > about fixing this bug in Release Notes, and returning VARCHARs
> > still does not work (did somebody fixed just half of the bug ?).
>
> Ivan:
> You are a long-time, respected, very experienced IB/FB developer.
> Could you be less newbie-behaved and describe which bug you are
> referring to, please? Or do I have to guess?

Sorry, if I spend more time writing my email in friday, I would miss
the last bus and had to sleep in office.

The bug was discussed several times in both support and devel lists,
and the problem was that regardless of declaration of the return value
(Cstring/Char/Varchar), Firebird always interpreted return value as CString.
(So e.g. for varchar with length<256 the first byte was binary zero,
thus the result was empty string.)

The result I obtained in Friday was that CHARs work as expected
(i.e. correct number of characters were returned, including those after binary zero),
and that VARCHARs do not work because they behave like CHARs
(i.e. unlike previous versions even data after binary zero were correctly returned,
however the result started with two bytes indicating string length, i.e. those two
bytes incorrectly become part of data).
Today I repeated the test with identical database, identical UDF,
and identical sql commands (just copy/pasted), and the result was - correct!
I have no idea whether there were high solar activity in Friday or what,
but the bug seems fixed now - thanks developers!

I have not find anything about fixing this bug in release notes nor on devel list.
Could this important fix be included in Release notes, please!? Thanks.

Ivan