How to debug a dynamic query with and without devel.

Public

Get raw version
php
  1. $query = db_select('node', 'n');
  2. $query
  3. ->fields('n', array('nid', 'title'))
  4. ->condition('n.type', 'article', '=');
  5. $result = $query->execute();
  6.  
  7.  
  8. dpq($query); # using devel
  9. print_r($query->__toString());