Skip to content

Instantly share code, notes, and snippets.

@bdlangton
Last active December 12, 2016 22:34
Show Gist options
  • Save bdlangton/f2ad5b4c06755a7f025ebfafdb6d0cae to your computer and use it in GitHub Desktop.
Save bdlangton/f2ad5b4c06755a7f025ebfafdb6d0cae to your computer and use it in GitHub Desktop.
Print out db_select/views final query for debugging
// Print out query built by views:
// Can use pre_execute or post_render (probably more also).
function hook_views_pre_execute(&$view) {
dpq($view->build_info['query']);
}
// Print out query build by db_select:
dpm((string) $query);
dpm($query->arguments());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment