0
因爲有以實現笨交易兩種可能的方式:我的事務代碼是否導致lock_wait_timeout錯誤?
1.自動
2.manual
I am getting an error like :Lock_wait_timeout
我笨application.I沒有任何錯誤查詢在我的code.But我發現,我已經寫交易代碼自動交易類似於手動交易。
作爲自動事務使用trans_start(),另一方面手動事務使用trans_begin()。
對於手動事務CodeIgniter使用以下語法
$this->db->trans_begin();
insert query...
update query...
if($this->db->trans_status()===FALSE){
$this->db->trans_rollback();
}else{
$this->db->trans_commit();
}
但我已經在我的代碼中使用自動交易,並寫下它像以下(使用,如果else語句像手動事務) :
$this->db->trans_start();
insert query...
update query...
$this->db->trans_complete();
if($this->db->trans_status()===FALSE){
$this->db->trans_rollback();
}else{
$this->db->trans_commit();
}