Kohana Database Library - How to Execute a Query with the Same Parameters More Than Once?

Posted by Noah Goodrich on Stack Overflow See other posts from Stack Overflow or by Noah Goodrich
Published on 2010-05-20T17:39:49Z Indexed on 2010/05/20 22:10 UTC
Read the original article Hit count: 298

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.

© Stack Overflow or respective owner

Related posts about php5

Related posts about kohana