Is it possible to change the limits of a Query without executing it again.
Here is my code:
$this->db->select("SQL_CALC_FOUND_ROWS e.emp_no, e.birth_date, e.first_name, e.last_name, e.gender, e.hire_date, t.title, s.salary, d.dept_name", FALSE)
->from('employees AS e')
->join('titles AS t', 'e.emp_no = t.emp_no')
->join('salaries AS s', 't.emp_no = s.emp_no')
->join('dept_emp AS de', 's.emp_no = de.emp_no')
->join('departments AS d', 'de.dept_no = d.dept_no')
->join('dept_manager AS dm', 'd.dept_no = dm.dept_no')
->order_by($sort_by, $sort_order)
->group_by('e.emp_no')
->where('t.title', $title)
->limit($limit, $offset);
$ret['rows'] = $q->get()->result();
I am using pagination so if I keep loading a query that return about 100,000 rows it slows down the return.
I wanted to make it faster by running the query once then changing the limit dynamically.