我正在使用codeigniter事务并使其工作。然而,在执行时什么也没有发生。这是我的代码:
public function submit($data){
$to_return = true;
$this->db->trans_begin();
$this->insert_arrest_details($data);
$this->insert_arresting_officers($data);
$folders = $this->insert_violators($data);
$this->insert_arrest_booking_form($data);
$this->insert_inventory(json_decode($data['inventory']));
$this->insert_items(json_decode($data['items']));
$this->insert_violator_items(json_decode($data['items']));
if($this->db->trans_status() === FALSE){
$to_return = $this->return_error_message();
}else{
$img_success = $this->move_violators_images($folders);
$img_success = $this->move_items_images(json_decode($data['inventory']));
$this->db->trans_commit();
}
return $to_return;
}
似乎我的代码什么都不做,当我检查我的网络,我没有得到任何响应。甚至错误也不存在。
有什么问题吗?如果这是事务锁定,它应该在50秒后提示我(我在配置中设置了这个),但它不是。
感谢您的回复。
谢谢!
尝试执行事务,然后返回状态。
$this->db->trans_start();
/*your code here*/
$this->db->trans_complete();
return $this->db->trans_status();