>- see footer for list info -<
what you want to do is steal some code from the debug templates 
(cfusionmx\wwwroot\web-inf\debug\classic.cfm).  Use the following, but instead 
of just outputting it all, maybe dump that to an email or db or whatever you're 
wanting:

<!--- Use the debugging service to check options --->
        <cftry>
                <cfobject action="CREATE" type="JAVA" 
class="coldfusion.server.ServiceFactory" name="factory">
                <cfset cfdebugger = factory.getDebuggingService()>
                <cfcatch type="Any"></cfcatch>
        </cftry>

        <!--- Load the debugging service's event table --->
        <cfset qEvents = cfdebugger.getDebugger().getData()>

        <!--- EVENT: SQL Queries --->
        <cftry>
                <cfquery dbType="query" name="cfdebug_queries" debug="false">
                        SELECT *, (endTime - startTime) AS executionTime
                        FROM qEvents
                        WHERE type = 'SqlQuery'
                </cfquery>
                <cfcatch type="Any"></cfcatch>
        </cftry>

<cfscript>
if (IsDefined("cfdebug_queries") AND cfdebug_queries.RecordCount GT 0) { 
bFoundSQLQueries = true; displayDebug=true; }
                        else { bFoundSQLQueries = false; }
</cfscript>

<!--- SQL Queries --->
<cfoutput>
<cfif bFoundSQLQueries>
        <cftry>
                <p class="cfdebug"><hr/><b class="cfdebuglge"><a 
name="cfdebug_sql">SQL Queries</a></b></p>
                <cfloop query="cfdebug_queries">
                        <code><b>#cfdebug_queries.name#</b> 
(Datasource=#cfdebug_queries.datasource#, 
Time=#Max(cfdebug_queries.executionTime, 0)#ms<cfif 
IsDefined("cfdebug_queries.rowcount") AND IsNumeric(cfdebug_queries.rowcount)>, 
Records=#Max(cfdebug_queries.rowcount, 0)#<cfelseif 
IsDefined("cfdebug_queries.result.recordCount")>, 
Records=#cfdebug_queries.result.recordCount#</cfif><cfif 
cfdebug_queries.cachedquery>, Cached Query</cfif>) in 
#cfdebug_queries.template# @ #TimeFormat(cfdebug_queries.timestamp, 
"HH:mm:ss.SSS")#</code><br />
                        <pre>#cfdebug_queries.body#</pre>
                        
                        <cfif arrayLen(cfdebug_queries.attributes) GT 0>
                            <code>Query Parameter Value(s) -<br />
                        
                            <cfloop index="x" from=1 
to="#arrayLen(cfdebug_queries.attributes)#">
                                <cfset thisParam = 
#cfdebug_queries.attributes[cfdebug_queries.currentRow][x]#>
                                Parameter ###x#<cfif StructKeyExists(thisParam, 
"sqlType")>(#thisParam.sqlType#)</cfif> = <cfif StructKeyExists(thisParam, 
"value")>#thisParam.value#</cfif><br />
                            </cfloop>
                            </code><br />
                        </cfif>
                </cfloop>
        <cfcatch type="Any">
                <!--- Error reporting query event --->
        </cfcatch>
</cftry>
</cfif>



Duncan Cumming
New Media Developer
Customer Relations Management / Education
Fife Council
700 4105 / 01592 414105

>>> [EMAIL PROTECTED] 22/09/2005 11:13 >>>
>- see footer for list info -<
Hi All,

Does anyone know if there's a way to display all of the available 
queries (some sort of scope or something) on a page without knowing 
their names.

basically I want to log the queries that are run on everypage without 
having to look at each page and workout what is running.

Thanks

Tom

        
        
                
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com 
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo 

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<



**********************************************************************
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed and 
should not be disclosed to any other party. 
If you have received this email in error please notify your system manager and 
the sender of this message.

This email message has been swept for the presence of computer viruses but no 
guarantee is given that this e-mail message and any attachments are free from 
viruses.

Fife Council
Tel: +44 (0) 1592 414141
**********************************************************************

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to