in reply to Re: How to safely test if a database handle is capable of transactions?
in thread How to safely test if a database handle is capable of transactions?
The DBI is a tied interface and you are not really breaking encapsulation by doing this. This is a perfectly acceptable way of doing business with this module - just see the docs.$dbh->{AutoCommit} = 0;
You did indirectly answer the OP's question (begin_work). According to the docs - If the driver does not support transactions then when begin_work attempts to set AutoCommit off the driver will trigger a fatal error. You just need to work it a bit differently since the OP wants to know if transactions are supported prior to trying a transaction. This means checking the actual contents of $@ rather than just seeing if it is set.
Cheers - L~R
|
|---|