CodeIgniter Forums
active record class: print sql - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: active record class: print sql (/showthread.php?tid=12416)



active record class: print sql - El Forum - 10-18-2008

[eluser]sl3dg3hamm3r[/eluser]
Hey there

Is there a function in the active record class which might give me back the plain sql which would be sent to the DB?

furthermore:
Is there a way to reset setted rules like
$this->db->where('')
?

Or is it anyhow resetted after $this->db->get()?

Sl3dg3


active record class: print sql - El Forum - 10-18-2008

[eluser]m4rw3r[/eluser]
Code:
echo $this->db->_compile_select();
Returns the SQL.

The reset is harder, but you can always directly clear the properties (and yes, it is reset after get()).


active record class: print sql - El Forum - 10-18-2008

[eluser]sl3dg3hamm3r[/eluser]
cool, thx!