Subject Re: [firebird-support] Re: followup to 'execute function'
Author Ann W. Harrison
At 02:47 PM 6/7/2004, Martijn Tonies wrote:
> >
> > Hmm; sorry, the distinction between stored procs and UDF's is still
> > a bit fuzzy in some ways. I understand from reading the InterBase
> > docs that UDF's should be very short, simple functions so they won't
> > tie up the database, esp. in the multi-threaded server (and, as you
> > said, they shouldn't query the database - and they certainly
> > shouldn't modify it as that may leave the database in an
> > inconsistent state. IIRC).

UDF's do not have database context. They don't know what 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.


Regards,

Ann
www.ibphoenix.com
We have answers.