Kohana Database Library - How to Execute a Query with the Same Parameters More Than Once?
- by Noah Goodrich
With the following bit of code:
$builder = ORM::factory('branch')->where('institution_id', $this->institution->id)->orderby('name');
I need to first execute:
$count = $builder->count_all();
Then I need to execute:
$rs = $builder->find_all($limit, $offset);
However, it appears that when I execute the first query the stored query parameters are cleared so that a fresh query can be executed.
Is there a way to avoid having the parameters cleared or at least copy them easily without having to reach directly into the Database driver object that stores the query parameters and copy them out?
We are using Kohana 2.3.4 and upgrading is not an option.