Subject Re: UDFs on Mac OS X
Author christian_stengel
--- In firebird-support@yahoogroups.com, jeffrobertsky@y... wrote:
>
> I just saw your message, and I think we're in the same boat,
> although I'm on Windows.

I'm not shure. As I said - UDFs work on Linux - with the SQL statements.

> Is the version of firebird on the machine that works as new as the
> one you installed to your Mac?

Both (client and server) are installed on the same machine (on the mac). I don't know
anything about Windows UDFs - but as MacOS X is a Unix machine - it should be the same
as on Linux.

I'm very suspisious of the .so error that it gives to me.

> If it's not a bug, then I hope someone will update the documentation
> to include whatever we're failing to do.

Your question was about UDFs in Hibernate? Well I have never worked with UDFs inside
Hibernate, but it should work this way:

1. Create an empty database (I have to do this within hibernate, as it dosn't create it from
hibernate for me)
2. declare that UDF (depends on your database tool - I use isql in the example)
3. run ant schemaexport

The following code assumes that you want to use the ABS function and it assumes, that
you are working on localhost:

-- snip --
isql -user sysdba -password masterkey

create database '127.0.0.1:/Volumes/common/database/test.fdb';
commit;
connect '127.0.0.1:/Volumes/common/database/test.fdb';
declare external function abs
double precision
returns double precision by value
entry_point 'IB_UDF_abs' module_name 'ib_udf';
commit;

exit;

ant schemaexport;

--

and it should do it without errors. The declare external function has to be called for every
stored procedure you want to user. The declarations of the UDFs can be found in the
examples directory (the .sql files) in FIREBIRD_HOME.

If it fails, try to access the UDF directry:

isql -user sysdba -password masterkey
connect '127.0.0.1:/path/to/database.fdb';
select abs(1/2) from rdb$database;

Does this get an error? If not, it's an hibernate issue (but I don't think though). If it gets an
error, what error do you get? Do you get the same error here?

The post your declaration string.

Chris

>
> -Jeff