puterboy has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to use $dbh->rollback to roll back changes in a MySQL database but it is not working.... No matter what I do, it always commits whether or not I issue a $dbh->commit() or a $dbh->rollback().
NOTE: I have $dbh->{AutoCommit}=0 (and I KNOW it is set in the right place because if I change it to '1' then I get the expected error that rollback is ineffective.
Here is sample code that fails:$dbh->{AutoCommit} = 0; $sth = $dbh->prepare("UPDATE $table SET title = 'new title' WHERE key1 + = ? AND key2= ?"); $sth->execute($key1, $key2); $dbh->rollback(); }
The code above always "COMMITS" and doesn't rollback. I.e., the title field is always changed for the selected record. What could be blocking the rollback from actually taking effect?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBI $dbh->rollback() NOT rolling back???
by runrig (Abbot) on Dec 20, 2010 at 16:42 UTC | |
by puterboy (Scribe) on Dec 20, 2010 at 19:12 UTC | |
by runrig (Abbot) on Dec 20, 2010 at 19:27 UTC | |
by puterboy (Scribe) on Dec 21, 2010 at 14:32 UTC | |
by globularset (Initiate) on Mar 10, 2013 at 00:45 UTC |
Back to
Seekers of Perl Wisdom