📅  最后修改于: 2022-03-11 14:54:27.277000             🧑  作者: Mango
beginTransaction();
try {
/* Change the database schema and data */
$sth = $dbh->exec("DROP TABLE fruit");
$sth = $dbh->exec("UPDATE dessert
SET name = 'hamburger'");
}
catch(Exception $e){
/* Recognize mistake and roll back changes */
$dbh->rollBack();
}
/* Commit changes */
$dbh->commit();