Subject Re: [firebird-support] How to obtain isc_db_handle and isc_tr_handle
Author Doug Chamberlin
At 10/20/2003 11:59 AM (Monday), Robert DiFalco wrote:
>I'm writing a UDF in C/C++ and wondering how I get isc_db_handle and
>isc_tr_handle. Apparently I need these to use the BOpen/BOpen2 methods.

Aparently you are trying to do something which is not appropriate for a
UDF. UDFs are not general purpose external hooks into the database server.

UDFs are normally simple functions which receive all data from parameters
and provide one value in return. They normally do not and should not engage
in any "external" activity such as accessing a database, sending an email,
file I/O, etc. This is because they are called from deep in the database
server engine's process and any screw-up on the UDF's part can have serious
consequences for the whole server.

If you really, really have to make a UDF do something beyond what it was
designed to do, you will get little support for your efforts from the IB/FB
community. It is really frowned upon.

That being said, I think the database server does not export the info you
are looking for. It provides no info on the operating context of the UDF
call beyond the params being passed.

Can you tell us what problem you are trying to solve and what the approach
you are exploring is? Perhaps we can suggest a better alternative.