Subject | Re: [firebird-support] Re: followup to 'execute function' |
---|---|
Author | Martijn Tonies |
Post date | 2004-06-08T07:39:12Z |
Hi,
CURRENT_CONNECTION and CURRENT_TRANSACTION
aren't valid handles (which you can use for the external Firebird API),
but rather internal counters.
simple.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com
> > UDF's do not have database context. They don't know whatYes. Very.
> connection
> > or what transaction they belong to. They can create temporary
> blobs,
> > because temporary blobs are outside normal database context. To
> use
> > UDF's to read or write data, you must make a separate connection
> and
> > start a transaction. That transaction can deadlock against the
> client
> > transaction that invoked the UDF, so that's messy.
> >
> > Stored procedures run in the context of the transaction that
> started
> > them.
>
> I was fooling around with UDF's, and looking into the ibpp library,
> and it seemed that ibpp could be very useful for UDF's (eg: nice
> wrappers for blobs, arrays, etc). But all the ibpp objects need a db
> connection and transaction context.
>
> So I wrapped my UDF with a stored proc, then passed down
> CURRENT_CONNECTION and CURRENT_TRANSACTION to the UDF, at which
> point (theoretically anyway) all the ibpp functionality should be
> available without requiring a separate database connection (hence,
> no deadlock).
>
> Am I off-base here?
CURRENT_CONNECTION and CURRENT_TRANSACTION
aren't valid handles (which you can use for the external Firebird API),
but rather internal counters.
>If not, is there any other reason a UDFExternal Functions should call back into the database. Plain and
> shouldn't be used instead of a sproc (I'd rather use a sproc, since
> their easier to maintain, but some things need to or should be done
> in C/C++)?
simple.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com