List of Queries Run?
I'm on a public server and cannot get debug information to show. Mostly I want to see the queries that have run on the page. Is there an existing structure I can reference to get a list of queries that have run on a page?
I'm on a public server and cannot get debug information to show. Mostly I want to see the queries that have run on the page. Is there an existing structure I can reference to get a list of queries that have run on a page?
Thanks to both responses. I was able to parse a list of the variable names but how do I test or parse each individual structure? Assume that one screen has a query named getTerritories.
<cfoutput>
Variable List: <br />
<cfloop list="#structKeyList(variables)#" index="ii">
#ii# <br />
</cfloop>
</cfoutput>
I think in order to get the SQL from more than one query, you'll need to add the result="varname" attribute to all the queries on the page.
Here's an example page, using an Oracle DB:
<cfquery name="Query1" datasource="ds" username="user" password="pass" result="Query1Info" >
SELECT 1 FROM dual
</cfquery>
<cfquery name="Query2" datasource="ds" username="user" password="pass" result="Query2Info" >
SELECT 1 FROM dual
</cfquery>
<cfloop collection="#VARIABLES#" item="EachVar">
<cfif isQuery(VARIABLES[EachVar]) >
<cfdump var="#VARIABLES[EachVar]#" label="#EachVar#" />
</cfif>
</cfloop>
Hope that helps.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.