ColdFusion 8: Dumping a Query in ColdFusion 8

So a small change - but a nice one. If you dump a query in ColdFusion 8, you now get a set of additional information along with the data. You get...

  • Whether or not the query was cached
  • The execution time
  • And best of all - the SQL!
  • Lastly - if your SQL contained any cfqueryparam tags, there will be a SQLParameters key that is an array of the values used in the cfqueryparam tags.

Edited to add last bullet point.


Download attached file.

Archived Comments

Comment 1 by tof posted on 6/5/2007 at 3:39 AM

Ray,

Do you get the SQL with or without "?"s ?.

Comment 2 by Fernando S. Trevisan posted on 6/5/2007 at 3:42 AM

tof asked the same question I was about to ask! This SQL output will include variables passed through CFSQLPARAM or just "?"?

Comment 3 by Ben Nadel posted on 6/5/2007 at 4:07 AM

He he, "poo". :) I think this is a great update to the CFDump tag.

Comment 4 by Raymond Camden posted on 6/5/2007 at 4:50 AM

I'll test right now.

Comment 5 by Raymond Camden posted on 6/5/2007 at 4:53 AM

So it shows a ?. But, there is an additional value in the dump - SQL Parameters, that is an array of values for the ?.

Comment 6 by Fernando S. Trevisan posted on 6/5/2007 at 4:57 AM

FANTASTIC.
Can you post a print? :)
Thanks as ever Ray.

Comment 7 by Thomas Messier posted on 6/5/2007 at 5:05 AM

Well I'll be damned... Maybe there's some other way of doing this or I'm just stating the obvious, but to access that SQL value it seems you need to specify the "result" attribute in the CFQUERY tag and the structure it produces will have the SQL value. But you know what else? That's not new in Scorpio, it works in CF 7 MX too. And I never knew about it. I'm rather happy I just found out because I'm gonna need to use this, like, immediately for a project!

Comment 8 by Thomas Messier posted on 6/5/2007 at 5:08 AM

Btw Ray, am I correct in assuming that this could be used to update ColdFire, since right now if you use cfqueryparam ColdFire doesn't display the right values for the query.

Comment 9 by Raymond Camden posted on 6/5/2007 at 6:46 AM

ColdFire has an update for this - submitted by someone in the community. I just haven't had a chance to approve it. I'm still recovering from the week or so of going from PC to Mac.

Comment 10 by Hemant posted on 6/5/2007 at 8:50 AM

You can go back to the old behaviour, if you like, by specifying false for metainfo attribute on the cfdump tag.

Comment 11 by Raymond Camden posted on 6/5/2007 at 3:39 PM

Thats nice. I assume it will be properly documented?

Comment 12 by Lola LB posted on 6/5/2007 at 4:02 PM

I really love this enhanced feature. Saves me from a lot of going back and forth.