Is there a method to make Devel initially show real arguments in query log instead of placeholders? This can be achieved for a single query in the log by clicking on the letter "A" in "ops" column in the query log. But e.g. to find all queries that refer to a specific node, or specific language, it is necessary to search for a particular nid, e.g. '184', or language value 'en', and it is not possible with placeholders. Theoreticaly someone may click 200 times on letter "A" on a single page and have all queries diaplay their real arguments, but perhaps there is any method to do it more efficiently?
Comment | File | Size | Author |
---|---|---|---|
#17 | 1190074-17.devel_.show-query-log-arguments.patch | 2.37 KB | joachim |
Comments
Comment #1
raincloud CreditAttribution: raincloud commentedDuring search I found a Views issue with similar title, but this is definitely Views issue because the suggested patch refers to Views module and not to Devel. But maybe they have something in common. Anyway, I need this for non-views pages.
Comment #2
raincloud CreditAttribution: raincloud commentedComment #3
moshe weitzman CreditAttribution: moshe weitzman commentedNot currently possible. Could be done via a greasemonkey script if you didn't want to submit it as a patch. I chose current default because it is much more compact.
Comment #4
raincloud CreditAttribution: raincloud commentedNo problem if it will work. Do you know any such particular existing script, a link maybe?
Comment #5
Ilya1st CreditAttribution: Ilya1st commentedHmmm.
I look at drupal core code on how queries work there.
http://api.drupal.org/api/drupal/includes--database--database.inc/functi...
using that you can replace placeholders with arguments(of course if you have access to them there)
So why they are not replaced before make output? No access to arguments when devel makes it's work?
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commented"I chose current default because the display is much more compact."
Comment #7
KingMoore CreditAttribution: KingMoore commentedIf you can click "A" and it works, why can't it be done by default? At first I thought it was not possible with Devel using the new DB API... but obviously it is possible because when I click "A" it shows it. This absolutely should be the default behavior.
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentedPlease read my earlier answers.
Comment #9
simanta CreditAttribution: simanta commentedHope this will help someone. The snippet is already tested with Drupal v7.26+Devel v7.x-1.4
1. Add below line before hook_help()
2. Replace the below code snippets as shown here -
2A From
To
AND
2B. From
To
Please note that the above changes need to be done on the devel.module file. Let me know in case of any further clarification.
Comment #10
gregglesHere's a patch version of #9.
I also changed from a constant to a variable. Things that are likely to change should be in variables instead of constants.
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedI dunno how realistic it is to run with this default over a long term. Your pages will routinely get miles long with huge Drupal queries.
Comment #12
gregglesMy experience is that with the query log on the page is already miles long and this doesn't make it significantly different. But...that's why its a variable instead of being hard-coded.
Comment #13
aangel CreditAttribution: aangel commentedThis is really nice to work with...thank you simanta and greggles!
Comment #14
rivimeyCan I just say that the 'patch' in #9 was very useful. Would be good to include some version of it in the main branch. I agree with Moshe's comment in #11 to the extent that placeholder should be the default, but that's easy to arrange.
Comment #15
gregglesPerhaps we should reopen this?
Comment #16
rivimey@greggles, I think it would be useful to have as an enable-able option under devel's config settings.
Comment #17
joachim CreditAttribution: joachim commentedPatch works great.
Here's an updated version which adds a setting to the Devel admin form.
Comment #18
moshe weitzman CreditAttribution: moshe weitzman at Acquia commentedQuery log feature is moving to webprofiler module for D8. We won't be adding features to it in prior versions.
Comment #19
rivimeyMoshe: "We won't be adding features to it in prior versions." :-(
Could we not have this in D7 -- it's no like D7 is dead yet?
Comment #20
pbcelery CreditAttribution: pbcelery commented+bump. Great tweak.
Comment #21
salvisTechnically, 7.x is not a prior version but the last version.
Seeing that we have a popular working patch, maybe we can make an exception here? Moshe?
I know you don't like adding options, but the case for this one (in the OP) is pretty convincing.
Comment #22
moshe weitzman CreditAttribution: moshe weitzman at Acquia commentedIf @salvis want to maintain this in D7 then I'm fine with him merging it.
Comment #25
salvisThanks, Moshe, and all who have helped with this.
Comment #27
Marko B CreditAttribution: Marko B commentedThere is also another problem, for example, eve if you have placeholders filled, queries from VIEWS are not complete. If you look below "field_data_field_last_name_user_entity_type" fields are fields from user fields and they lack relationship in this query. Some joins of tables. But this is what you get in develop, this is also what you get in views sql output, so some changes to query must occur somewhere later?