Make compatible to libdbi >= 0.9.0

Several functions of libdbi are now deprecated (e.g.: dbi_conn_new) and have
been replaced with _r functions (e.g.: dbi_conn_new_r) which now require a
dbi_instance passed as a parameter. This patch checks if the version of libdbi
is higher or equal than 0.9.0 and iff so, it uses the new _r functions instead
of the deprecated ones.