官方:
儲存引擎 | 說明 |
---|---|
MyISAM | Default engine as of MySQL 3.23 with great performance |
MEMORY | Hash based, stored in memory, useful for temporary tables |
InnoDB | Supports transactions, row-level locking, and foreign keys |
BerkeleyDB | Supports transactions and page-level locking |
BLACKHOLE | /dev/null storage engine (anything you write to it disappears) |
EXAMPLE | Example storage engine |
ARCHIVE | Archive storage engine |
CSV | CSV storage engine |
ndbcluster | Clustered, fault-tolerant, memory-based tables |
FEDERATED | Federated MySQL storage engine |
MRG_MYISAM | Collection of identical MyISAM tables |
ISAM | Obsolete storage engine |
由表看出MyISAM沒有支援Transaction(交易),所以即使PDO的交易函數也沒辦法使用
MYSQL引擎要換成InnoDB才行
try{
$dbh->beginTransaction();
$sth = $dbh->exec("DROP TABLE fruit");
$sth = $dbh->exec("UPDATE dessert SET name = 'hamburger'");
$dbh->commit();
}catch(Exception $e){
$dbh->rollBack();
$e->getMessage();
}
沒有留言:
張貼留言