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 at 1:00 am by MrNate

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.

Too old to comment!
On Dec 8, 2007 at 1:00 AM Jeff Gladnick (jeffglad at the ever-endearing gmail.com) said:
THANK YOU!!!

I'm glad someone finally did something about this. I was just complaining about this the other day.

Adobe/NA/Railo, how about incorporating a standard feature right into CF debugging.

On Dec 8, 2007 at 1:00 AM Sami Hoda (samihoda at the endearing gmail.com) said:
There is already a Firefox native tool to do this for you already up on RiaForge. All you do is aopcy and paste the whole sql, and when you paste it its automatically converted for you in proper sql format.

On Dec 9, 2007 at 1:00 AM todd sharp (todd@example.com who would have preferred an address at cfsilence.com) said:
.NET? Why not AIR?

On Dec 10, 2007 at 1:00 AM Chris (coldfusion, visiting us from procept.net) said:
@Jeff

Railo does indeed display the correct query with the bind params filled in.

On Dec 10, 2007 at 1:00 AM Dmitriy Goltseker (dave12j at the ever-endearing hotmail.com) said:
Thank you. It's a very helpful tool. It's not true that there's nothing out there other than this. Some time ago Nathan Mische wrote a plugin to do exactly the same thing.

On Dec 10, 2007 at 1:00 AM Nathan Strutz (http://www.dopefly.com/) said:
Sami, Dmitriy, I didn't know about Nathan Mische's Firefox plugin. That seems pretty cool.

Todd, I'm just playing with my c# skills, whereas I'm not so well gifted in AS. I'll consider it though.

Thanks for your comments, I hope you all like my toy.

On Dec 10, 2007 at 1:00 AM Dmitriy Goltseker (dave12j, who breathes hotmail.com) said:
He has one for firefox and another of for IE (http://www.mischefamily.com/nathan/index.cfm/2007/3/8/CF-Debug-Copy-for-Internet-Explorer).

Hope this helps. I know it did to me.

Dmitriy

On Dec 10, 2007 at 1:00 AM Jeff (jeffglad whose email lies with gmail.com) said:
Railo does do it, thanks!

On Dec 10, 2007 at 1:00 AM Leon Miller-Out (dopefly sends love to l.singlebrook.com) said:
I actually modified the stock debug template to include bind variable values inline in the SQL string. Check out the post I just wrote to read more and download my template.
Too old to comment!