【发布时间】:2012-07-02 20:36:07
【问题描述】:
CodeIgniter 中的$this->db->trans_status() 究竟是如何理解事务中的查询是否成功的?
来源:http://codeigniter.com/user_guide/database/transactions.html
$this->db->trans_begin();
$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER QUERY...');
$this->db->query('AND YET ANOTHER QUERY...');
if ($this->db->trans_status() === FALSE){
$this->db->trans_rollback();
}
else{
$this->db->trans_commit();
}
我使用 MySQL 作为底层数据库
【问题讨论】:
-
为什么不通过CI's source code 亲自看看呢?
标签: mysql codeigniter transactions