On Tue, Nov 20, 2012 at 7:59 AM, Rainer Gerhards <rgerha...@gmail.com> wrote:
> On Tue, Nov 20, 2012 at 1:02 PM, Markus Hoenicka
> <markus.hoeni...@mhoenicka.de> wrote:
>> In fact, we already have a (not well documented) infrastructure for things
>> like this in place. Every driver keeps a list of boolean "capabilities"
>> which is merely a key-value list of whatever we think is useful or
>> necessary. To date, only the "safe_dlclose" capability seems to be used, see
>> e.g. dbd_initialize in libdbi-drivers/drivers/mysql/dbd_mysql.c. There is an
>> internal function _dbd_register_driver_cap() which can be used by the
>> drivers to announce a capability. And there is a public function
>> dbi_driver_cap_get() which allows applications to query the list of
>> capabilities at runtime. So all we'd have to do is modify the drivers and
>> have them add a "transaction_support" capability set to 1 for those who
>> support transactions.
> ok, that makes sense and is excellent to have!
>>> For TX support, I'd expect calls for
>>> - begin transaction
>>> - commit
>>> - rollback
>>> that's it, so all in all 4 calls. Would you agree to that?

First, I'm glad to so movement on this! The code in the project I'm
involved with handles transactions on its own already using something
along the lines of the wrapper pattern Markus mentioned, so it won't
make a big difference to me immediately, but having a sanctioned API
is almost always better, IMO.

I think I'd add three calls to the proposed API, though, for support
of savepoints.  They're part of the SQL standard, and supported by
several SQL RDBMS' including Postgres (the db my project uses, and we
use libdbi to connect to PG).  The relevant PG documentation is
available at http://www.postgresql.org/docs/9.1/static/sql-savepoint.html
.  I have wrappers for savepoints in my implementation, and they are
very handy for complex DB interactions.

I can't offer many properly shaped tuits toward the development effort
right now, but supporting savepoints should amount to essentially
adding cut-and-paste duplicates of begin, commit and rollback.  Would
it be objectionable to ask for savepoint support to piggy-back on
transaction support?

Mike Rylander
 | Director of Research and Development
 | Equinox Software, Inc. / Your Library's Guide to Open Source
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  mi...@esilibrary.com
 | web:  http://www.esilibrary.com

Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
libdbi-users mailing list

Reply via email to