Just rememeber debugging has to be on (though not necessarrily displaying)
for this method to work.
Why dont you do your query like
sql = "select * from table where col = ?" (or use the savecontent style for
larger querries)
then
myquery = myConnectionCFC.execute(sql, stParameters)
for debugging display the sql then list of parameters
and process sql and parameters something like (cut from something bigger)
<cfset var lSQL = variables.sql & " ">
<cfset var aSegments = ListToArray(lSQL & " ", "?")>
<cfset var iSegments = arraylen(aSegments)>
<cfquery name="qResults" datasource="#stDSN.Datasource#"
username="#stDSN.Username#" password="#stDSN.Password#" maxrows="#maxrows#">
<cfloop index="i" from="1" to="#iSegments#">
<cfset segment = aSegments[i]>
<cfoutput>#segment#</cfoutput>
<cfif i lt iSegments>
<cfset stParameter = variables.aParameters[i]>
<cfif stParameter.value eq "NULL">
<cfqueryparam null="Yes">
<cfelseif stParameter.datatype eq "sql">
#stParameter.value#
<cfelse>
<cfset cfDataType = getCFParameterType(stParameter.datatype)>
<cfif stParameter.list>
<cfqueryparam value="#stParameter.value#" cfsqltype="#cfDataType#"
list="Yes" separator="#stParameter.seperator#">
<cfelse>
<cfqueryparam value="#stParameter.value#" cfsqltype="#cfDataType#" >
</cfif>
</cfif>
</cfif>
</cfloop>
</cfquery>
if you are interested i can put the files together for you
Elliot
"Barry Beattie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
cheers Adam
yes, that's getting closer. I'll have to put the cfqueryparams in with
string manip but that's on the track
now if I can just tear apart factory.getDebuggingService().getDebugger()
I should get what I want exactly
thanx again
barry.b
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adam
Cameron
Sent: Wednesday, 1 September 2004 3:03 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: capturing the executed query?
> I seem to remember (somewhere) a way of getting the actual SQL of a
> query that has been run in a variable (ie: for debugging, etc).
<cfquery name="q" datasource="dsn">
your query here
</cfquery>
<cfset factory = createObject("java",
"coldfusion.server.ServiceFactory")>
<cfset cfdebugger = factory.getDebuggingService()>
<cfset qEvents = cfdebugger.getDebugger().getData()>
<cfquery dbtype="query" name="cfdebug_queries" debug="false">
SELECT *, (endTime - startTime) AS executionTime
FROM qEvents
WHERE type = 'SqlQuery'
</cfquery>
<cfdump var="#cfdebug_queries#">
Pinched from the debugging template @
CFusionDir]\WEB-INF\debug\classic.cfm
Adam
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/