flush or reset codeigniter active records without execute after build?
activerecord, codeigniter
Solution
You can use these two functions for your requirements
public function _compile_select($select_override = FALSE)
public function _reset_select()
To use them you will have to remove public or private keywords. Go to system/database/DB_active_rec.php Remove public or protected keyword from these functions
Example usage
$this->db->select('trans_id');
$this->db->from('myTable');
$this->db->where('code','B');
$subQuery = $this->db->_compile_select();
$this->db->_reset_select();
$subQuery contains the query string and _reset_select resets the active record so you can write a new query.
Problem
Actually i saw some suggestions in stackoverflow itself but didnt get the exact solution for this issue, Please dont think this is a duplicate. Am using memcache for my codeigniter site and active records to build query. Am using ``` this->db->return_query_string(); ``` to get the query from active records before executing .Now i want to flush the active records with out executing the same query. also from various references ``` $this->db->start_cache(); $this->db->stop_cache(); $this->db->flush_cache() ``` may do the job is this is the exact result? if so how can i get the cached query with out execute