Currently CodeIgniter does not have way to see query built my active record. For example in ZF you can echo out SQL made by Zend Select. So, I wrote similar thing for CI.
CodeIgniter does include $this->db->last_query(); which will show you the query.
As far I know $this->db->last_query(); only shows latest query that was fired. My modification shows query that was prepared by active record before query execution. For more information please visit http://framework.zend.com/manual/en/zend.db.select.html#zend.db.select.execute.tostring.
That only shows the last executed query. This gives you the potential to view/dump query as you are building it.
Seems like a neat little query, though it'd probably be better if it were renamed to something like current_querry() instead of overriding the __toString() method of the class
this has already been added