Why does active record count_all_results() is calling _reset_select() ? |
[eluser]Aken[/eluser]
Just trying to provide an option for recreating queries without duplicating your code. Like I said, it's not ideal. I agree that an addition for including the total rows regardless of limit/offset would be a good addition. You should add a feature request to the Github repository requesting this. There's a few ways that could go about it - all of which would need to keep backwards compatibility in mind (don't want to break any current apps).
[eluser]skunkbad[/eluser]
If you look at the _do_user_records_query() method in my user model, then you can see how I did it: bitbucket.org/skunkbad/community-auth-ci-session-version/src/6ae0d164035d/application/helpers/MY_url_helper.php/user_model.php Two other methods are calling that method, and in other (newer) projects that I am working on, there is only one method. Easy stuff.
[eluser]the_yk[/eluser]
If I understand your problem correctly, maybe what you need is Active Record Caching Code: $this->db->start_cache(); see how WHERE clause is cached. If you want to know how many records you get in result set, simply use count Code: $num_result = count($result_set); Dont forget to flush the cache when you're done with it, otherwise, it'll mess with your other query. Code: $this->db->flush_cache();
[eluser]InsiteFX[/eluser]
And what is wrong with this to create your own calls? CodeIgniter Users Guide - Custom Function Calls
[eluser]bientek[/eluser]
the_yk, thanks for your post. This ended up being the most elegant solution to my problem of having to repeat the query after running count_all_results(). |
Welcome Guest, Not a member yet? Register Sign In |