Subject | Re: In a Firebird UDF, can you establish a connection back to the database? |
---|---|
Author | Steve |
Post date | 2010-12-31T11:11:46Z |
Dear Ann:
After re-reading your response, I can now see that you said it *is* possible. First of all , thank you for replying.
After re-reading your response, I can now see that you said it *is* possible. First of all , thank you for replying.
--- In firebird-support@yahoogroups.com, "Ann" <aharrison@...> wrote:
> Yes, but you establish an entirely new connection, so you're
> queries are not part of the same transaction as the thread
> that invoked the UDF. You won't see changes made by the UDF
> in your transactions. Nor will you see changes you made
> from the UDF. Generally, that's reason enough not to try
> to circle back from a UDF. The fact that your transaction
> can deadlock against the UDF transaction adds to the disincentive.
By saying 'Yes' - do you confirm that it is possible to establish a connection back to the database from within the UDF?
If so, then please let me know how I can do it , and how I can run a stored procedure (that only performs a SELECT and returns data) from the UDF. This is my main requirement.
Assuming that it is possible, then there must be something wrong with the component that I am using that causes my program to freeze upon connection. I am going to post this question on the UniDac newsgroups now to be certain if it is indeed possible or if it is a problem with their component that is causing my program to freeze.
>
> A better architecture, generally, is to invert whatever you're
> doing so a procedure drives the UDF rather than trying to invoke
> a procedure from a UDF.
>
I understand this, and am doing this in fact. However, I have a special requirement that the UDF further calls a stored procedure to retrieve some data from the database (it is an expression evaluator and calculator, whose input includes regular arithmetic expressions, and functions that depend on data from the database ).
Yours sincerely,
Steve Faleiro