求教 关于ci中事务处理
$this->db->trans_start();$this->capital_service->pay($config);
$this->db->update(.......);
$this->db->trans_complete();
其中capital_service的pay函数中也用到了事务,想请问大神,在这种情况下,上面四条指令如果出错会回滚吗?{:1_1:} 当事务嵌套的时候,最外层的有效。
When transactions are nested we only begin/commit/rollback the outermost ones
jeongee 发表于 2016-2-11 16:57
当事务嵌套的时候,最外层的有效。
When transactions are nested we only begin/commit/rollback the oute ...
也就是说调用函数中如果出错也是会回滚的吗? wo很忙 发表于 2016-2-13 17:05
也就是说调用函数中如果出错也是会回滚的吗?
没错! jeongee 发表于 2016-2-14 09:31
没错!
好的!非常感谢。另外还想问一下您,如果在
$this->db->trans_start();
和
$this->db->trans_complete();
之间,就执行了return操作会造成什么后果吗?比如造成锁之类的吗 wo很忙 发表于 2016-2-15 19:45
好的!非常感谢。另外还想问一下您,如果在
$this->db->trans_start();
和
最好不要这么干,return前结束掉事务为好。 jeongee 发表于 2016-2-16 09:09
最好不要这么干,return前结束掉事务为好。
好的,最近经常发现有莫名锁死问题,估计就是这个问题。 jeongee 发表于 2016-2-16 09:09
最好不要这么干,return前结束掉事务为好。
大神方便给个方便交流点的联系方式吗?偶尔有问题可以请教一下您{:1_1:}
页:
[1]