Jochen Wiedmann <[EMAIL PROTECTED]> wrote: > > Is there a way to ask DBI if it is already in a transaction? > Read the AutCommit flag. :-)
It says, Enable transactions (by turning "AutoCommit" off) until the next call to "commit" or "rollback". After the next "commit" or "roll- back", "AutoCommit" will automatically be turned on again. If "AutoCommit" is already off when "begin_work" is called then it does nothing except return an error. If the driver does not support transactions then when "begin_work" attempts to set "AutoCommit" off the driver will trigger a fatal error. However, when using the DBD::Pg driver, begin_work only triggers an error if the driver was *initialized* with AutoCommit off, and if you begin_work with AutoCommit on, the next query to $dbh->{AutoCommit} still returns true, and transactions nest successfully. So is the DBD::Pg driver in error then? (In other words, there's no support for nested transactions in DBI at all?) - Tyler