A few weeks ago I posted about fixing CF's DB error messages so that they include query params you passed as well as the raw SQL of the query. I also supplied a patch for detail.cfm so your SQL renders in a PRE tag for better readability, but didn't make it general enough to handle all cases. I've addressed that with some reflection, as illustrated in the patches below. They're almost identical, but not quite.
If you did NOT use my patch from a few weeks ago (i.e. you have a stock CF), you'll want this patch (plus the unmodified patch for DatabaseException.cfm):
Index: WEB-INF/exception/detail.cfm =================================================================== --- WEB-INF/exception/detail.cfm (revision 1495) +++ WEB-INF/exception/detail.cfm (working copy) @@ -213,6 +213,12 @@ <cfif isDefined("attributes.properties")> <tr><td> <!--- Format and display miscellaneous exception properties. ---> + <cftry> + <cfset isSql = getClass().forName("java.sql.SQLException").isAssignableFrom(getClass().forName(error.type)) /> + <cfcatch type="java.lang.ClassNotFoundException"> + <cfset isSql = false /> + </cfcatch> + </cftry> <table border="0" cellpadding="0" cellspacing="0"> <cfset exclude="localizedmessage,locale,detail,message,tagcontext,rootcause"> @@ -227,8 +233,8 @@ </cfcatch> </cftry> <tr> - <td><font style="COLOR: black; FONT: 8pt/11pt verdana">#xmlFormat(m)#</font></td> - <td><font style="COLOR: black; FONT: 8pt/11pt verdana"> #htmlEditFormat(val)#</font></td> + <td valign="top"><font style="COLOR: black; FONT: 8pt/11pt verdana">#xmlFormat(m)#</font></td> + <td><font style="COLOR: black; FONT: 8pt/11pt verdana"><cfif isSql AND listFindNoCase("sql,parameters", m) GT 0><pre>#htmlEditFormat(REReplace(val, "#chr(10)#\s*#chr(10)#", chr(10), "all"))#</pre><cfelse> #htmlEditFormat(val)#</cfif></font></td> </tr> </cfif> </cfloop>
If you already patched with the first version, apply this one instead to get just the upgrade:
Index: WEB-INF/exception/detail.cfm =================================================================== --- WEB-INF/exception/detail.cfm (revision 6066) +++ WEB-INF/exception/detail.cfm (working copy) @@ -213,6 +213,12 @@ <cfif isDefined("attributes.properties")> <tr><td> <!--- Format and display miscellaneous exception properties. ---> + <cftry> + <cfset isSql = getClass().forName("java.sql.SQLException").isAssignableFrom(getClass().forName(error.type)) /> + <cfcatch type="java.lang.ClassNotFoundException"> + <cfset isSql = false /> + </cfcatch> + </cftry> <table border="0" cellpadding="0" cellspacing="0"> <cfset exclude="localizedmessage,locale,detail,message,tagcontext,rootcause"> @@ -228,7 +234,7 @@ </cftry> <tr> <td valign="top"><font style="COLOR: black; FONT: 8pt/11pt verdana">#xmlFormat(m)#</font></td> - <td><font style="COLOR: black; FONT: 8pt/11pt verdana"><cfif error.type EQ "java.sql.SQLException" AND listFindNoCase("sql,parameters", m) GT 0><pre>#htmlEditFormat(REReplace(val, "#chr(10)#\s*#chr(10)#", chr(10), "all"))#</pre><cfelse> #htmlEditFormat(val)#</cfif></font></td> + <td><font style="COLOR: black; FONT: 8pt/11pt verdana"><cfif isSql AND listFindNoCase("sql,parameters", m) GT 0><pre>#htmlEditFormat(REReplace(val, "#chr(10)#\s*#chr(10)#", chr(10), "all"))#</pre><cfelse> #htmlEditFormat(val)#</cfif></font></td> </tr> </cfif> </cfloop>
Hope it makes your life as much easier as it makes mine.
Barney if you are into coldfusion you should have lori hook you up with her brother. His name is Stephen Holmes, he holds about 160 patents with /thru IBM most concerning cold fusion, speed, and nanotech. He works in Fishkill NY at IBM but the computer makes it a small world. Perhaps he could be a resource to you .. hell all i know is swimming but the way he talks and the way you write … you two should hook up. You'd like him he is the wierd one of Lori's very ecentric family