Subject Re: [ib-support]
Author Helen Borrie
At 09:47 PM 04-06-02 -0700, Dimitris Ioannidis wrote:
>Hi all,
> i have a custom UDF in FireBird/Win and i want to
>call it from my app with IBO.
> My UDF takes one parameter as string, and returns Integer.
>Cause i am new to this, how can i execute the UDF and
>supply the parameter at run-time...?
> My UDF is like F_FOO( Param ).. I try to do it with
>the IB_DSQL, and in the SQL property i put
>And in IB_DSQL.FieldByName('F_FOO').AsInteger i get
>the result ...
> Now how can i change in run-time the '12qw' with
>something :MyParam, and execute it ?

In principle, it would be:

However, this will cause an error "Unknown datatype" because your parameter
is not a database column. As a rule, it doesn't make sense to call a UDF
that doesn't act on data that are already on the server - you can do this
calculation in your application and avoid unnecessary network traffic.

>How i declare a Param in the IB_DSQL ?

This is an IB Objects question and should be posted there for a more
detailed answer. However, as a general observation, you don't declare
Delphi parameters. IBO (and, to some degree, other Delphi data-aware
components) recognise the ":APARAM" syntax and do what a database object
should do. Assignment to input parameters uses a range of methods,
including ParamByName(). For output parameters, read FieldByName(), et al.

In IBO you can also force a datatype on your input parameter through
Params[] properties, but I still don't recommend using a UDF for
transforming non-database data.

Further questions to the appropriate list please - Firebird and InterBase
only here.


All for Open and Open for All
Firebird Open SQL Database · ·