/** * 删除数据 * @param array|string $where 条件 * @param int $limit 删除数量限制,默认不限制 * @return int $delete_count 删除的记录数 */ public function delete($where, $limit = NULL) { if (!is_null($limit) && is_numeric($limit)) { $this->where($where); if (is_numeric($limit)) { $this->db->limit($limit); } $this->db->delete($this->_name); return $this->db->affected_rows(); } $this->db->delete($this->_name, $where); return $this->db->affected_rows(); }
/** * Inserts custom LIMIT clausule to given active record. * * @param CI_DB_active_record $db database active record object. * @return void */ private function insertLimit(CI_DB_active_record $db) { if (is_array($this->custom_limit) && count($this->custom_limit) == 2) { $db->limit($this->custom_limit[0], $this->custom_limit[1]); } }