[cfaussie] Re: Query Parameter List in the Error Structure
What version of CF are you using? In 7, there is the new RESULT attribute allowing you to name a variable which is a structure, and one of its keys is SQL and another is sqlparameters: CFQUERY NAME=demoq DATASOURCE=cfdocexamples result=test select * from employees where lastname = cfqueryparam cfsqltype=CF_SQL_VARCHAR value=smith /CFQUERY cfdump var=#demoq# cfdump var=#test# that returns: query - Top 2 of 2 Rows DEPARTMENT EMAIL EMP_ID FIRSTNAME IM_ID LASTNAME LOCATION PHONE 1Accounting ASMITH 4 Aaron [EMAIL PROTECTED] Smith San Francisco (612) 832-7201 2Administration JSMITH 9 Jenna [EMAIL PROTECTED] Smith San Diego (612) 832-7422 struct CACHED false COLUMNLIST DEPARTMENT,EMAIL,EMP_ID,FIRSTNAME,IM_ID,LASTNAME,LOCATION,PHONE EXECUTIONTIME250 RECORDCOUNT 2 SQL select * from employees where lastname = ? SQLPARAMETERS array 1smith If you're using an older release, I seem to recall some undocumented functions, accessing the debug info I think, or perhaps accessing the underlying query result set object, that may help. But in case you're at 7, check out the above which is fully supported. /Charlie http://www.carehart.org/blog/ -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Scott Thornton Sent: Tuesday, February 20, 2007 5:52 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Query Parameter List in the Error Structure Hi, I use a site wide error template that emails the text of the query that caused a problem. When the query uses cfqueryparam tags the parameters passed are in the form (param 1) etc in the text of the query. Is it possible to find out what these params are? To get the SQL I use: error.rootCause.SQL If I try to dump error.rootCause to take a look what is inside I get [Unknown Type] displayed. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~--~~~~--~~--~--~---
[cfaussie] Re: Query Parameter List in the Error Structure
The [Unknown Type] can normally be fixed with this hotfix http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=1a9c83c -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Scott Thornton Sent: Wednesday, 21 February 2007 12:08 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Query Parameter List in the Error Structure Hi Charlie, Using CF MX 6.1. Damn. __ This email, including attachments, is intended only for the addressee and may be confidential, privileged and subject to copyright. If you have received this email in error, please advise the sender and delete it. If you are not the intended recipient of this email, you must not use, copy or disclose its content to anyone. You must not copy or communicate to others content that is confidential or subject to copyright, unless you have the consent of the content owner. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~--~~~~--~~--~--~---
[cfaussie] Re: Query Parameter List in the Error Structure
OK, I've done a little digging and this works in CFMX 6 and 7: CFQUERY NAME=demoq DATASOURCE=cfdocexamples select * from employees where lastname = cfqueryparam value=smith cfsqltype=CF_SQL_VARCHAR /CFQUERY cfdump var=#demoq# cfset factory = createobject(java, coldfusion.server.ServiceFactory) cfset debug = factory.DebuggingService.getDebugger().getData() cfquery dbtype=query name=getqueries select * from debug where template = '#cgi.cf_template_path#' and type='SqlQuery' /cfquery cfoutput query=getqueries Query name: #name#br SQL statement: #body#br cfdump var=#getqueries.attributes#!--- this is an array--- p /cfoutput !--- cfdump var=#debug# --- Note that if you wanted to get just one particular query on a page, you could add a WHERE clause for name='yourqueryname' in the Q of Q. /Charlie http://www.carehart.org/blog/ -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Scott Thornton Sent: Tuesday, February 20, 2007 8:08 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Query Parameter List in the Error Structure Hi Charlie, Using CF MX 6.1. Damn. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~--~~~~--~~--~--~---