Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jun 2011 at 01:08 UTC
Updated:
13 Aug 2011 at 21:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
dawehnerThis would be indeed a feature request and afaik this would require quite an amount of changes in the code.
Comment #2
mstrelan commentedI agreed and accept that the javascript part would be difficult, however I just had a quick search through the code and it actually looks like this feature is meant to exist (without the toggle).
views/includes/admin.inc (around line 203)
$rows['query'][] = array('<strong>' . t('Query') . '</strong>', '<pre>' . check_plain(strtr($query, $quoted)) . '</pre>');$query is the sql with placeholders
$quoted is an array of replacements from the database layer
Further up the code (around line 191) the query arguments that views takes care of are stored in a variable
$argumentshowever this variable is not used again.Change line 203 to the following and it will work.
$rows['query'][] = array('<strong>' . t('Query') . '</strong>', '<pre>' . check_plain(strtr($query, array_merge($quoted, $arguments))) . '</pre>');Happy to create a patch if you need, just in a rush right now. I could probably also make it a setting on the advanced settings page.
Comment #3
mstrelan commentedI've changed my perspective slightly on this. It would seem to me that placeholders such as
:views_join_condition_0are pretty meaningless here and it is probably not likely that you would need to toggle between them. It is also a regression as I don't believe we had this in 6.x-2.x. Patch attached.Comment #4
merlinofchaos commentedShockingly easy.
Comment #5
mototribe commentedsubscribe
Comment #6
mstrelan commented@mototribe - Just go download 7.x-3.0-rc1, the patch is committed there.
Comment #7
mstrelan commentedWhat's the difference between
$query->arguments()and$query->getArguments()? This issue isn't quite resolved for some use cases. An example is if you have a node reference as an argument the query output printsentity_type = noderather thanentity_type = 'node'.A more detailed output
LEFT JOIN {field_data_field_exhibition} field_data_field_exhibition ON node.nid = field_data_field_exhibition.entity_id AND (field_data_field_exhibition.entity_type = node AND field_data_field_exhibition.deleted = 0)I've attached a patch that will call
$connection->quote()on ALL of the arguments, but I'm not sure if there is a reason this was not already done.Comment #8
mstrelan commentedThis one is probably better.
Comment #9
mstrelan commentedAnother use case that has the issue described in #7 is when you have a filter criteria of a taxonomy term in a particular vocabulary.
The query output is:
my_vocabulary needs quotes around it. The patch in #8 also resolves this issue.
Comment #10
dawehnerOh this seemed to be a duplicate of #1185914: Missed quotes in SQL query visualisation but the patch got commited.