Subject Re: FW: [ib-support] UDFs and NULL
Author Doug Chamberlin
At 9/16/2001 12:29 PM (Sunday), Dimitar Selensky wrote:
>Is there a way to tell that a certain parameter passed to an UDF function
>is null?

No, there is no definitive way to do this. It has been requested many times
and is on the list of enhancements being contemplated.

At 9/17/2001 08:38 AM (Monday), Gerhardus Geldenhuis wrote:
>Here is a function I use in Delphi to check for null
>procedure CheckVariables(var RF,WF:Integer);
>begin
> if VarIsNull(RF) then
> RF:=0;
> if VarIsNull(WF) then
> WF:=0;
>end;

While this may seem to work correctly in some cases, it is really a mis-use
of the VarisNull function. I would NOT recommend relying of this code since
it can produce an access violation and bring down your Interbase server.
IIRC, VarIsNull is designed and intended to be used with Variants only. The
parameters to your functions are of type Integer, not Variant. Therefore,
in this case I expect the VarIsNull is playing nice and returning a default
value when it sees it is being called with an incorrect parameter.