用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2798|回复: 1
收起左侧

[讨论/交流] 数据库 嵌套事务 处理问题

[复制链接]
发表于 2013-5-20 16:37:47 | 显示全部楼层 |阅读模式
CI 中 DB_driver.php 的这段代码的目的 应该是为了防止嵌套事务吧:


   // When transactions are nested we only begin/commit/rollback the outermost ones
                if ($this->_trans_depth > 0)
                {
                        $this->_trans_depth += 1;
                        return;
                }

             $this->trans_begin($test_mode);

但一开始 _trans_depth =0 这段if永远不能被执行。所以是不是应该改成:


        $this->_trans_depth += 1;
        // When transactions are nested we only begin/commit/rollback the outermost ones
        if ($this->_trans_depth > 1)
        {   
            return;
        }   

        $this->trans_begin($test_mode);


同样trans_complete() 也要做相应修改。


发表于 2014-10-10 13:22:55 | 显示全部楼层
mysql是不支持事务嵌套,估计作者写这个是todo的意思吧

本版积分规则