cfqueryparam debug replace question marks

I was getting pretty unhappy with the whole question mark situation today whilst trying to debug a query. As a standard we use cfqueryparam all the time and if you get a large query with lots of variables then it can be a nightmare if you need to run it Query Analyzer. So I fiddled […]
Last updated: March 12, 2012

I was getting pretty unhappy with the whole question mark situation today whilst trying to debug a query. As a standard we use cfqueryparam all the time and if you get a large query with lots of variables then it can be a nightmare if you need to run it Query Analyzer. So I fiddled around for a while and started to try and get the debugging to replace the question marks with the proper values. Heres what I came up with: The debug file that produces the debugging is in the {cfroot}\wwroot\WEB-INF\debug at least on a single server install. We run multiserver in production but we never have debiug on over there, so theres no point in putting it up. Before we start copy the classic.cfm and call it queryParam.cfm just in case we bugger it up – also its copyright Adobe etc etc. download the completed file here. Near the top of the queryParam.cfm (line 59 for me) there is a query:

Now a word of dislaimer – this is only done for SQL server, and I havent tested it massively. If you find that a var doesnt have the single quotes around it then add the cf_sql_vtypename to this line:

Save it and go to your cfadministrator – open the debugging settings section and change the debug template to queryParam.cfm. Save and try it out. Any comments or improvements I would love to hear them! This only works on CF 7.0 and above.

Duncan Isaksen-Loxton

Educated as a web developer, with over 20 years of internet based work and experience, Duncan is a Google Workspace Certified Collaboration Engineer and a WordPress expert.
Login
Log in below to access your courses.
Log In With Google
Forgot Password
Enter your email address or username and we’ll send you instructions to reset your password.