Subject ODBC via UDF
Author unordained
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.


My thinking was that the functions could be used like:


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


I've no time to work on building this at the moment, but if someone's already
started, or has ideas, or ... a different subscription list I should as in ...

(Note: I don't use ODBC, ever. My understanding of the API is limited to a few
minutes of reading through examples.)

-Philip