coldfusion result attributes

During my exploration of the previous article I needed to view the SQL statement that was being dynamically generated.
Fortunately Coldfusion has add the “result” attribute to cfquery. This allows you to see things like execution time, sql, sql arguments, etc…

<cfquery name="q" datasource="myDSN" result="rq">>
select * from #mytable#
where source = #sourcesel#
</cfquery>
...
<cfdump var="#rq#">
Yields all the info about the query stored in the result set.
...
<cfoutput>#rq.sql# </cfoutput>
yields the SQL only
"select * from theRealTableName where source= 200"

Cup size   
Select size then click on coffee cup.
This entry was posted in Code, Coldfusion, Snippets. Bookmark the permalink.