经天纬地大魔王 发表于 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() 也要做相应修改。


zdkmygod 发表于 2014-10-10 13:22:55

mysql是不支持事务嵌套,估计作者写这个是todo的意思吧
页: [1]
查看完整版本: 数据库 嵌套事务 处理问题