Nice DPQ

Categories

Component ID

1941106

Component name

Nice DPQ

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

1859

Component created

Component changed

Component body

Alternative to Devel's dpq(), with added linebreaks and indentation for readability.

Example of a nested query:

  $q_nested = db_select(..);
  ...
  $q = db_select(..);
  $q->leftJoin($q_nested, ...);
  ...
  nicedpq($q);

Result (in the message area):

SELECT
  nested.*,
  b.width AS width,
  b.height AS height
FROM
  bbb b
  LEFT OUTER JOIN (
    SELECT
      a.x AS x,
      a.y AS y,
      a.b_id AS b_id
    FROM
      aaa a
    WHERE
      (z = 5) AND
      (y > 2.2)
    GROUP BY
      a.b_id
  ) nested ON 
    nested.b_id = b.id
ORDER BY
  b.width ASC

Explanation:
Devel dpq() simply uses the SelectQuery::__toString() method.
nicedpq() has its own way to generate a more readable output.