Ask a Jedi: Working with ColdFusion’s Debug Query Display and CFQUERYPARAM

Eric asked a question I thought others might be interested in as well:

Ray, I often find it useful when a cfquery tanks to take the SQL code provided in the error, put it into my editor, and play around with the code there. However, when using cfqueryparam, this becomes a much bigger challenge because the values are not directly in the SQL query. I have to sort through the param structure and manually replace the values with (param 1) etc. Is there any way to grab the query with the param values replaced?


If you don’t know what he means, he is talking about debug displays like so….

There are multiple ways you can work with this. Obviously you can cut and paste, but for anything besides a simple query, this is going to be difficult. ColdFire automatically replaces the ? when it displays the query:

Other options include additional plugins by Nathan Mische (who is running ColdFire now don’t forget):

CF Debug Copy for Fire: This will work with ColdFusion’s classic debug output and let you simply right click/copy into the correct format.

ColdFusion Debug SQL Explorer Extension: This is another option that works with an Eclipse plugin. CFEclipse users may prefer this one, but I haven’t tried it myself. (My queries never have errors. Ever.)