The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

Free toy inside! - A debugging tool, CFQuery Reassembler

posted under category: Free Code For You on December 8, 2007 by Nathan

Back a few years ago, before bind parameters were the cool thing to do with your queries (even if they should have been), it was easier to debug your queries in ColdFusion because you could scroll down to the debugging information, copy your SQL statement and paste it into your database tool of choice to run ad-hoc style.

Now that we're more sophisticated, the queries that show up in your debugging output aren't so easy to copy and paste. You get output like this:

insert into users (
  name,
  address1,
  address2,
  city,
  state,
  postal,
  country
) values (
  ?,
  ?,
  ?,
  ?,
  ?,
  ?,
  ?
)

Query Parameter Value(s) -
Parameter #1(cf_sql_varchar) = Nathan
Parameter #2(cf_sql_varchar) = 1234 Main St.
Parameter #3(cf_sql_varchar) =
Parameter #4(cf_sql_varchar) = Phoenix
Parameter #5(cf_sql_varchar) = AZ
Parameter #6(cf_sql_varchar) = 85001
Parameter #7(cf_sql_varchar) = US


How useless is that? You can't copy and paste that into your database query tool. Short of changing your debug template, you're stuck moving those values into the query one at a time to run it again in a controlled environment.

So I made a tool to simplify this. It's a simple .NET desktop application. You paste your debugging output query (like that shown above) and it will fix all the fields and give you something to paste back into your SQL editor, ready to run.

CFQuery Reassembler 1CFQuery Reassembler 2

It's a simple concept, and maybe I'm the only one who will ever use it, which is fine, but let me know if you like it, if you can use it, and what improvements we can make.

Download the CFQuery Reassembler now (requires .NET runtime 2.0). I would call this the 1.0 preview version. If you get any queries that don't come out right, drop a message here or mail me. If you have any useful suggestions, I'm all ears, but please remember I'm not a c# winforms guy, so don't expect any real magic.

PS - I'm releasing this as a BSD-licensed application. You can download the CFQuery Reassembler source code and VS2005 project files, here.

Nathan is a software developer at The Boeing Company in Charleston, SC. He is essentially a big programming nerd. Really, you could say that makes him a nerd among nerds. Aside from making software for the web, he plays with tech toys and likes to think about programming's big picture while speaking at conferences and generally impressing people with massive nerdiness and straight-faced sarcastic humor. Nathan got his programming start writing batch files in DOS. It should go without saying, but these thought and opinions have nothing to do with Boeing in any way.
This blog is also available as an RSS 2.0 feed. Click your heels together and click here to contact Nathan.