This one has bugged me for a long time. ColdFusion allows you to build SQL statements dynamically (using variables, expressions, conditions, and more), but have you ever wanted to know exactly what that final generated SQL was? ColdFusion obviously knows what it is, and if you have debugging turned on then it gets displayed (I even wrote a UDF to return the SQL string, but it only works if debugging is turned on), but thus far it has never been exposed to us developers. Well, this should be changing in Blackstone, along with RecordCount and ColumnList and ExecutionTime, there’ll be additional data exposed, including the final SQL statement. (Note that I said “should”, not “will”).
Yet another example of one of the many infrequently discussed goodies in the works.

7 thoughts

  1. Fantastic! Any help we can get on identifying which files caused the errors, where they are, and the sql necessary to reproduce it the better.
    I’d like to request that when CFCs are called, and they return a record set that there be an easier way to dump the record set into the debugging stream also. For instance, we use a CFC with a stored procedure in it all we see in the debugging is ‘recordset 1’ instead of the actual data returned.

  2. Please let it be so! I’d so love to be able to easily turn on a SQL logging facility (which I wrap around my data access layer code) w/o having to turn on debugging!

  3. This would be really great but would it be as plain text? If this could be colour-coded in cfdump, it would be really useful.

  4. Richard, it is plain text. And honestly, I am not sure I’d like formatting in there, although your suggestion that CFDUMP color code SQL is an interesting one.

  5. Thanks for the quick response.
    I agree the query should be returned plain text. But cfdump colour-coding the sql would be a God send.
    If it can go one step further and highlight the points where ColdFusion variables were used in the SQL, it would be awesome, though I don’t know how practical it would be to implement.

Leave a Reply to Jacob Cancel reply