Hello!
I have made OpenDBX header for FB. It can be used to access to several DB systems (all DB systems OpenDBX let) with same interface using OpenDBX compiled DLLs (or .so in *nix). Now I don't have it in anywhere. I would like to know if it is of interest and how I could send the file.
Thanks a lot.
Regards.
OpenDBX Header for FB
Re: OpenDBX Header for FB
Hello again,
I posted FB OpenDBX header file in:
https://xfer.fbxl.net/www/?a=d&i=6409497572
Next I paste a very simple example of connection to Oracle:
Thanks a lot!
-------------------------------------------------
#include "opendbx/api.bi"
dim as odbx_t ptr handle
dim as long r
dim as string query
dim as timeval t
dim as odbx_result_t ptr result
dim as integer x
t.tv_sec = 3
t.tv_usec = 0
r = odbx_init(@handle, "oracle", "aaa.bbb.ccc.ddd", "1521")
if r < 0 then
print "Initialization error. Error: " & *(odbx_error(handle, r))
else
print "Initialized."
end if
r = odbx_bind_simple(handle, "db", "user", "password")
if r < 0 then
print "Connection Error. Error: " & *(odbx_error(handle, r))
else
print "Connected."
query = "SELECT columnA, columnB, columnC FROM table ORDER BY columnA"
r = odbx_query(handle, query, len(query))
if r < 0 then
print "Query error. Error: " & *(odbx_error(handle, r))
else
print "Query is OK."
r = odbx_result(handle, @result, @t, 0)
if r < 0 then
print "Getting data error. Error: " & *(odbx_error(handle, r))
else
print "Getting data."
print *(odbx_column_name(result, 0)), *(odbx_column_name(result, 1)), *(odbx_column_name(result, 2))
while odbx_row_fetch(result) <> ODBX_ROW_DONE
print *(odbx_field_value(result, 0)), *(odbx_field_value(result, 1)), *(odbx_field_value(result, 2))
wend
odbx_result_finish(result)
end if
end if
r = odbx_unbind(handle)
if r < 0 then
print "Disconnection error. Error: " & *(odbx_error(handle, r))
else
print "Disconnected."
end if
end if
r = odbx_finish(handle)
if r < 0 then
print "Finishing error. Error: " & *(odbx_error(handle, r))
else
print "Finished."
end if
I posted FB OpenDBX header file in:
https://xfer.fbxl.net/www/?a=d&i=6409497572
Next I paste a very simple example of connection to Oracle:
Thanks a lot!
-------------------------------------------------
#include "opendbx/api.bi"
dim as odbx_t ptr handle
dim as long r
dim as string query
dim as timeval t
dim as odbx_result_t ptr result
dim as integer x
t.tv_sec = 3
t.tv_usec = 0
r = odbx_init(@handle, "oracle", "aaa.bbb.ccc.ddd", "1521")
if r < 0 then
print "Initialization error. Error: " & *(odbx_error(handle, r))
else
print "Initialized."
end if
r = odbx_bind_simple(handle, "db", "user", "password")
if r < 0 then
print "Connection Error. Error: " & *(odbx_error(handle, r))
else
print "Connected."
query = "SELECT columnA, columnB, columnC FROM table ORDER BY columnA"
r = odbx_query(handle, query, len(query))
if r < 0 then
print "Query error. Error: " & *(odbx_error(handle, r))
else
print "Query is OK."
r = odbx_result(handle, @result, @t, 0)
if r < 0 then
print "Getting data error. Error: " & *(odbx_error(handle, r))
else
print "Getting data."
print *(odbx_column_name(result, 0)), *(odbx_column_name(result, 1)), *(odbx_column_name(result, 2))
while odbx_row_fetch(result) <> ODBX_ROW_DONE
print *(odbx_field_value(result, 0)), *(odbx_field_value(result, 1)), *(odbx_field_value(result, 2))
wend
odbx_result_finish(result)
end if
end if
r = odbx_unbind(handle)
if r < 0 then
print "Disconnection error. Error: " & *(odbx_error(handle, r))
else
print "Disconnected."
end if
end if
r = odbx_finish(handle)
if r < 0 then
print "Finishing error. Error: " & *(odbx_error(handle, r))
else
print "Finished."
end if