in reply to Testing if DBI has a commit pending?
There is always the Executed flag in DBI:
Executed (boolean)
The Executed attribute is true if the handle object has been "executed". Currently only the $dbh do() method and the $sth execute(), execute_array(), and execute_for_fetch() methods set the Executed attribute.
When it's set on a handle it is also set on the parent handle at the same time. So calling execute() on a $sth also sets the Executed attribute on the parent $dbh.
The Executed attribute for a database handle is cleared by the commit() and rollback() methods. The Executed attribute of a statement handle is not cleared by the DBI under any circumstances and so acts as a permanent record of whether the statement handle was ever used.
The Executed attribute was added in DBI 1.41.
Update: I must admit to some curiousity, as to why you might need this functionality. I generally rely on the AUTOCOMMIT flag, and rollback as necessary, in the rare occasions when I have multi-stage transactions that go bad. Can you comment on your use case?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Testing if DBI has a commit pending?
by gam3 (Curate) on Sep 19, 2006 at 15:19 UTC | |
by eric256 (Parson) on Sep 19, 2006 at 17:48 UTC |