Subject Re: NULL Date values
Author jeff_j_dunlap
--- In, Paul Vinkenoog <paul@...>
> In addition:
> > Look at the declaration of the function DateToStr
> > (...)
> > If, on the other hand, it is passed by reference (pointer or
> > cstring) or by descriptor, the function can tell NULLs from zeroes
> > and should be improved.
> If you should choose to go down this avenue I should add that
> - with descriptors, UDFs can always handle NULLs
> - with cstrings, even if the UDF can handle NULL input, the
> Firebird engine will by default pass NULL arguments as empty
> *unless* you use Firebird 2 *and* the function is declared in a
> special way to the database. Fot details, see
> and more in particular
> But it's probably quicker to follow Nando's advice and use a CASE
> statement. Still it would be a good idea to report this undesired
> behaviour to the rfunc team.
> Cheers,
> Paul

Hi Paul,

Thanks a bunch for the info and the URLs. I also read your Null
Guide docs and they were a big help.

Believe it or not, rFunc's DateToStr() was the first external UDF
that I was going to use in my web app. I am really surprised that
DateToStr() returns 11.17.4294967254 when it encounters a NULL date.
I think that it should return a blank string instead. I wonder what
other rFunc users do?

Here is the declaration:

ENTRY_POINT 'fn_datetostr' MODULE_NAME 'rfunc';

Nando's CASE advise would solve this problem but I think that I am
going to leave the conversion to the client app by creating a
fbDateToStr() function.

Again, thanks for your help.