Subject Re: [firebird-support] ODBC via UDF
Author Ann W. Harrison
unordained wrote:
> Has anyone attempted to build a UDF bridge to call ODBC functions? My
> understanding was that providing Firebird-to-AnyDatabase functionality was still
> in the design stages for Firebird 3 (maybe). In the mean time, this could have
> provided a workable, if imperfect, solution.
> ...
> create or alter procedure get_stuff_from_other_db (a integer, b varchar(50))
> returns (c integer, d varchar(100)) as
> declare variable h1;
> begin
> h1 = odbc_connect(current_transaction, 'other_db');
> h2 = odbc_prepare(:h1, 'select bob, larry from stuff');
> odbc_bind_integer(:h2, 1, :a);
> odbc_bind_text(:h2, 2, :b);
> h3 = odbc_execute(:h2);
> while (odbc_more(:h3) do
> begin
> c = odbc_get_integer(:h3, 1);
> d = odbc_get_text(:h3, 2);
> suspend;
> end
> odbc_close_resultset(:h3);
> odbc_close_statement(:h2);
> odbc_close_connection(:h1);
> end
>

That kind of breaks transactions ... the remote transaction is committed
while the local transaction is still running...

Best regards,

Ann