I have worked a lot on codeigniter. In codeigniter , if there is need to get query string that is executed last, we can get it using:
echo $this->db->l
If you are running queries directly on your model instance and you are lazy, you can also do it like this:
$result = $this->_userEntriesEntries->find(array("conditions" => "FeaturedPost = 1 and FeaturedPostStatus = 1", "order" => "ID DESC", "limit" => 4))
var_dump($result);
var_dump
the result object of your query. Within the PDO dump you will notice a key named _pdoStatement
. This is your generated SQL query.
This is not the recommended way, just a dirty trick.