所以我的问题是我是否应该使用PDO或mysqli。由于来自php PDO page的以下警告,我担心使用PDO。
警告注意:某些MySQL表类型(存储引擎)不支持事务。使用不支持事务的表类型编写事务数据库代码时,MySQL将假装成功启动了事务。此外,发出的任何DDL查询都将隐式提交任何挂起的事务。
将来会出现什么样的问题?
如果我只使用mysqli会更好吗? (不确定是否有相同的问题)
答案 0 :(得分:2)
我认为警告是因为所有类型的mysql storage engines
都不支持事务。不支持事务的引擎将立即自动提交数据。因此,请检查引擎列表及其工作差异。
mysql> SHOW ENGINES;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+