Subject | RE: [firebird-support] rFunc UDF - linux and Windows |
---|---|
Author | Helen Borrie |
Post date | 2008-03-06T02:24:34Z |
At 09:44 AM 6/03/2008, Codebue Fabio - P-Soft wrote:
So - if you expect your input argument to be double precision, declare the Int64 version instead. - read the fbsql.sql file for details.
./heLen
>[quote helen]The fbudf ROUND function passes and returns its arguments and result BY DESCRIPTOR. That means that the engine will take care of details like scale and precision in the input argument and return the expected result. It *doesn't* mean that a real is an invalid input argument -- unless you pass one that has too much precision, i.e., a double precision or a numeric with precision > 9.
>You said that access to a ROUND function is the only reason you use the
>rFunc library. Why don't you use the ROUND function from fbudf? Then you
>would not have to worry about whether the library had multi-platform support
>or whether you had the right version for the particular DB engine version.
>
>--FBUDF_API paramdsc* fbround(paramdsc* v, paramdsc* rc)
>declare external function Round
>int by descriptor, int by descriptor
>returns parameter 2
>entry_point 'fbround' module_name 'fbudf';
>[/quote helen]
>I use rFunc ROUND function because, like you can understand with follow
>declaration, they are different!!!
>
>DECLARE EXTERNAL FUNCTION ROUND
> DOUBLE PRECISION, INTEGER
> RETURNS DOUBLE PRECISION BY VALUE
> ENTRY_POINT 'fn_round' MODULE_NAME 'rfunc';
>
>WHY udf, and repeat why a round function accept an integer value to round
>it? is it not already rounded?
So - if you expect your input argument to be double precision, declare the Int64 version instead. - read the fbsql.sql file for details.
./heLen