【发布时间】:2018-12-19 05:47:52
【问题描述】:
我尝试使用此代码,但我调用的存储过程仍在数据库中运行,但在代码中它已经完成。
$this->db->trans_start();
$this->db->query('CALL sp_process();');
if ($this->db->trans_status() === FALSE) {# Something went wrong.
$this->response->message[] = array(
'message' => "Encountered a problem",
'type' => 'error'
);
}
else {
$this->db->trans_commit();
$this->response->message[] = array(
'message' => 'successfully processed',
'type' => 'success'
);
}
$this->db->trans_complete();
【问题讨论】:
-
$this->db->trans_begin(); $this->db->query('AN SQL QUERY...'); $this->db->query('另一个查询...'); $this->db->query('AND YET ANOTHER QUERY...'); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); } 其他 { $this->db->trans_commit(); }
标签: php mysql codeigniter stored-procedures