Rainer Gerhards <rgerha...@gmail.com> was heard to say:

> That's what I would expect. However, I think it would be useful to
> have a call like "drvrTXSupport()" returning 1 if the driver supports
> transaction and 0 otherwise. That way, an app could either fall back
> to non-transcation mode OR tell the user that the database system is
> not suitable for that kind of application. That would probably also
> provide a smooth migration path, were only the primary TX interface
> needs to be implemented and drivers can be upgraded as time permits
> (assuming that some drivers are maintained by external entities).

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.

> 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?

yes, except that we don't need the drvrTXSupport() function as we can  
use dbi_driver_cap_get() instead.

>> This should be easy to retrofit. I'lls see if I find
>> some time but feel free to beat me at it.
> I am quite busy myself at the moment, but I could try and see if I
> could craft something along that path...
> Rainer


Markus Hoenicka
AQ score 38

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