title: how to print query in CakePHP
body: <p>Actually,</p>
  
  <p>I have written this code in <strong>AppController.php</strong> in <strong>CakePHP 2.2.2</strong></p>
  
  <pre><code>class AppModel extends Model
  {
    function getLastQuery()
    {
        $dbo = $this-&gt;getDatasource();
        $logs = $dbo-&gt;getLog();
        $lastLog = end($logs['log']);
        return $lastLog['query'];
    }
  }
  </code></pre>
  
  <p>I tried following code to print output query</p>
  
  <pre><code>echo $this-&gt;AssetModel-&gt;getLastQuery(); 
  $this-&gt;render('sql');
  </code></pre>
  
  <p>Is any body know to the point solution for that....?</p>