Vikram Noel Ambrose writes:
 > I just built libdbi and libdbi-drivers from svn. When recompiling my 
 > application, I got a warning saying, dbi_initialize, dbi_conn_new and 
 > dbi_shutdown has been deprecated.
 > 
 > I think the docs online are out of data:
 > http://libdbi.sourceforge.net/docs/programmers-guide/reference-core.html
 > 
 > What are those functions being replaced with?

The docs reflect the situation as of the latest official release. This
should probably be spelled out somewhere to make things clear. If you
fiddle with the current svn version, please build the programmers
guide from the sources.

The current svn version implements a new feature called "instances"
which required us to change the API slightly. In a nutshell, a libdbi
instance allows you to initialize libdbi, load and unload drivers, and
shut down the library independently from other parts of your program
which also use libdbi. The problem came up with some piece of software
which was designed to load modules at runtime. Some of these modules
used libdbi. In order to unload such a module properly, you'd have to
shut down the library. But that would have made libdbi unavailable to
the remaining modules.

Therefore the new interface uses instance handles to manage the
library. A single process can open as many instances as it needs, and
initialize and shut them down individually. The new initializer
requires a pointer to a dbi_inst structure:

int dbi_initialize_r(const char *driverdir, dbi_inst *pInst);

You'll need this handle later to create connections and to shut down
the instance:

dbi_conn dbi_conn_new_r(const char *name, dbi_inst Inst);
void dbi_shutdown_r(dbi_inst Inst);

The older versions (dbi_initialize, dbi_conn_new and dbi_shutdown) are
now implemented on top of these functions, using a single static instance
handle.

HTH
Markus

-- 
Markus Hoenicka
http://www.mhoenicka.de
AQ score 38

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users

Reply via email to