Created
October 31, 2012 08:20
-
-
Save junaidpv/3985830 to your computer and use it in GitHub Desktop.
View the query executed by the view in Drupal 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/sites/all/modules/views/plugins/views_plugin_query_default.inc b/sites/all/modules/views/plugins/views_plugin_query_default.inc | |
| index 39e8061..1a34443 100644 | |
| --- a/sites/all/modules/views/plugins/views_plugin_query_default.inc | |
| +++ b/sites/all/modules/views/plugins/views_plugin_query_default.inc | |
| @@ -1393,6 +1393,19 @@ class views_plugin_query_default extends views_plugin_query { | |
| $query->range($offset, $limit); | |
| } | |
| + $query_string = (string)$query; | |
| + $query_string = str_replace('{', '', $query_string); | |
| + $query_string = str_replace('}', '', $query_string); | |
| + $query_params = $query->getArguments(); | |
| + foreach($query_params as $placeholder => $value) { | |
| + if(!is_numeric($value)) { | |
| + $query_string = str_replace($placeholder, "'$value'", $query_string); | |
| + } | |
| + else { | |
| + $query_string = str_replace($placeholder, $value, $query_string); | |
| + } | |
| + } | |
| + drupal_set_message($query_string); | |
| $result = $query->execute(); | |
| $view->result = array(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment