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?