Subject | Re: [IBO] UDF Parameter Bug in IBO ???? |
---|---|
Author | Helmut Steinberger |
Post date | 2003-11-17T22:13:14Z |
>What version of IBO are you using?As I wrote in my last Post I uses the latest Version of IBO,
downloaded yesterday. (4.3A)
>Part of the problem has to do with me using the extended type in delphi toI do not think, if it has something to do with the extended type.
>contain the value rather than a double. This is an area I've only partially
>addressed with the 3.4 release. Perhaps what I did in this release will be
>sufficient. Please get the latest and let me know. Use the eval version if
>you need to.
This was just an example with the double parameter.
You can do it with every datatype.
Fact is, that every parameter after the 2nd will be interpreted as the
same datatype like the 2nd parameter.
If you declare this UDF:
DECLARE EXTERNAL FUNCTION TEST_UDF
double precision,
integer,
date
RETURNS integer BY VALUE
ENTRY_POINT 'test_udf' MODULE_NAME 'testlib'^
the 3rd parameter will be interpreted as integer.
If you declare this UDF:
DECLARE EXTERNAL FUNCTION TEST_UDF
integer,
date,
double precision
RETURNS integer BY VALUE
ENTRY_POINT 'test_udf' MODULE_NAME 'testlib'^
the 3rd parameter will be interpreted as date.
If you declare this UDF:
DECLARE EXTERNAL FUNCTION TEST_UDF
date,
integer,
double precision
RETURNS integer BY VALUE
ENTRY_POINT 'test_udf' MODULE_NAME 'testlib'^
the 3rd parameter will be interpreted as integer.
If you declare this UDF:
DECLARE EXTERNAL FUNCTION TEST_UDF
date,
double precision,
integer
RETURNS integer BY VALUE
ENTRY_POINT 'test_udf' MODULE_NAME 'testlib'^
the 3rd parameter will be interpreted as double.
And so on.
I hope that helps to understand what I meen.
You can reproduce it by declaring an UDF like I described in my
previous post.
I repeat it here:
The Pascal Code of the UDF :
function test_udf (var intparam : integer;
var intparam2 : integer;
var doubleparam : double) : double; stdcall;
begin
doubleparam := (doubleparam + intparam + intparam2) / 2;
result := doubleparam;
end;
The UDF is declared to FB like that:
DECLARE EXTERNAL FUNCTION TEST_UDF
integer,
integer,
double precision
RETURNS double precision BY VALUE
ENTRY_POINT 'test_udf' MODULE_NAME 'testlib'^
Then set up an ib_query or ib_cursor and set the sql.text of it to
select test_udf (:a, :b, :c) from rdb$database
Then set
ib_query.parambyname ('a').asinteger := 1;
ib_query.parambyname ('b').asinteger := 2;
until here it works.
But if you try to set
ib_query.parambyname ('c').asfloat := 2.9;
you will get an exception: 2.9 is not a valid integer value.
Please try it.
cu
Helmut