title: Yii - How to print SQL used by findAll
body: <p>I have the following code to get some records from db</p>
  
  <pre><code>    $criteria = new CDbCriteria();
      $criteria-&gt;condition = 't.date BETWEEN "'.$from_date.'" AND "'.$to_date.'"';
      $criteria-&gt;with = array('order');
  
      $orders = ProductOrder::model()-&gt;findAll($criteria);
  </code></pre>
  
  <p>Is it possible to get the SQL that is used by the findAll? I know you can get it from the debug console. But I'm running the script in the background using yiic.php</p>