我在CodeIgniter的表上運行update_batch(),我想檢查它是否成功。在CodeIgniter中檢查update_batch()是否成功
我使用affected_rows()試過了,但僅計算已被修改,所以它並不完全切斷它的表單字段數量:
$this->db->update_batch("sections", $data, "alias");
log_message("debug", "items in form: ".count($data));
// items in form: 3
log_message("debug", "rows updated: ".$this->db->affected_rows());
// rows updated: 0-3
// depending on whether anything was actually changed on the form
return ($this->db->affected_rows() == count($data)); // unreliable
這似乎是一個相當簡單的事情從批量更新功能詢問。有沒有我錯過了,或者我應該寫我自己的批量更新代碼?
正在使用Transactions而不是CI的'update_batch'選項嗎? –
我在這個項目上使用MyISAM,因爲它是一個簡單的CMS,不會經常更新。雖然好,但我可能會考慮切換到InnoDB。 – Andrey