Debug SQL queries from a controller in cakePHP
Getting last query on CakePHP when you need to exit in the middle of the action is pretty annoying. You would usually do a function where the dataSource would be instantiated and then you would access the queryLog.
$log = $this->Model_name->getDataSource()->getLog(false, false); debug($log);