Develop #612

Closed
wants to merge 2 commits into
from

Projects

None yet

5 participants

@nicholasnet

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.

@ericbarnes
Contributor

CodeIgniter does include $this->db->last_query(); which will show you the query.

@nicholasnet

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.

@saintnicster
Contributor

https://github.com/EllisLab/CodeIgniter/blob/develop/system/database/DB_driver.php#L679

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

@ruthlessfish
Contributor

this has already been added

#307
12e93fe

@derekjones derekjones closed this Oct 31, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment