Subject | Re: [IBO] UDF Parameter Bug in IBO ???? |
---|---|
Author | Helen Borrie |
Post date | 2003-11-17T12:24:42Z |
At 12:54 PM 17/11/2003 +0100, you wrote:
related to params, since the parameter problem related to returned values,
not input values.
I can't pinpoint your problem exactly, but I'm sure it has to do with 1)
mismatched data types and 2) the fact that your return parameter has no name.
Your query provides no clue about the SQLType of the input parameters,
because it is operating neither on database field values (which IBO would
get from a Prepare) nor on constant values. At Prepare time, there is
nothing there for the type-casting routine to work with, so it is
"pot-luck". This problem is typical of what happens with select {something
unspecified] from rdb$database.
For example, if you do
select 'today' - 1 from rdb$database
you get a prepare error back "Expression evaluation not supported. But if
you do
select cast ('today' as date) - 1 from rdb$database
you get yesterday's date back, with a blank field name.
I'd consider it worth a try to rephrase your query so that you typecast
everything and provide a name for the return parameter, viz.
select test_udf (cast(:a as integer), cast(:b as integer), cast(:c as double))
as ret_value
from rdb$database
good luck!
Helen
> >I'm sure the calling convention for UDFs is cdecl !!!! stdcall is probablyWell, I think it has to do with data types. I don't see how it can be
> >what is messing things up.
>
>o.k. I changed it, but the result is still the same.
>
>If this would be the reason for the problem, why does the statement
>
>select test_udf (1, 2, 2.9) from rdb$database
>
>work as expected and
>
>select test_udf (:a, :b, :c) from rdb$database
>
>doesn't?
related to params, since the parameter problem related to returned values,
not input values.
I can't pinpoint your problem exactly, but I'm sure it has to do with 1)
mismatched data types and 2) the fact that your return parameter has no name.
Your query provides no clue about the SQLType of the input parameters,
because it is operating neither on database field values (which IBO would
get from a Prepare) nor on constant values. At Prepare time, there is
nothing there for the type-casting routine to work with, so it is
"pot-luck". This problem is typical of what happens with select {something
unspecified] from rdb$database.
For example, if you do
select 'today' - 1 from rdb$database
you get a prepare error back "Expression evaluation not supported. But if
you do
select cast ('today' as date) - 1 from rdb$database
you get yesterday's date back, with a blank field name.
I'd consider it worth a try to rephrase your query so that you typecast
everything and provide a name for the return parameter, viz.
select test_udf (cast(:a as integer), cast(:b as integer), cast(:c as double))
as ret_value
from rdb$database
good luck!
Helen