save query debugging parameterized (sql and params)

Description

currently query debugging is saved converted with queryparams inlined

this makes it hard to meta analyze query performance, coz every sql is mostly unique, due to params

debugging should just save the sql and the params separately, combining on rendering debug, if needed!

this could make debugging (aka in prod) faster, i.e. only producing the simple sql view without parameters when rendering debug output

to do this, the params, need to be added to the qry debugging

Activity

Show:

Beau Gibson 13 October 2024 at 23:46

We’ve just upgraded to 6.1.0.243 and have noticed this change causing issues in debugging when a queryparam includes a comma.

https://github.com/lucee/Lucee/commit/3fa19daf32ca3e818fca15b8f67ede9b25336370

 

This is building a comma separated string without escaping existing commas, causing an array index error when converted to an array for looping. This is reproducible by enabling Classic debugging and running any query with a value containing a comma eg:

<cfquery name="variables.comma"> select <cfqueryparam value="comma, seperated, value" cfsqltype="cf_sql_varchar"> as val from dual </cfquery>

and the following appears in the debug output:

variables.comma (Datasource=datasource, Time=1.46ms, Records=1) in [[redacted]]
the following colum(s) are never read within the request:VAL

select 'comma, seperated, value' as val from dual
Query Parameter Value(s) - #1 Parameter(CF_SQL_VARCHAR) = comma #2 Parameter(

 

Lucee 6.1.0.243 Error (expression)

Message

Array index [2] out of range, array size is [1]

Function

info

Component

lucee-server.admin.info.Info

Stacktrace

The Error Occurred in
/opt/lucee/tomcat/lucee-server/context/context/admin/debug/Classic.cfc: line 386

384: <cfset paramType1 = listtoarray(queries.paramType, ",")>
385: <cfoutput>
386:    <pre><b> Query Parameter Value(s) - </b><br><br><cfloop from="1" to="#arraylen(paramValue1)#" index="i">###i# Parameter(#paramType1[i]#) = #paramValue1[i]#<br></cfloop></pre>
387: </cfoutput>
388: </cfif>

called from /opt/lucee/tomcat/lucee-server/context/context/admin/debug/Classic.cfc: line 373
called from /opt/lucee/tomcat/lucee-server/context/context/admin/info/Info.cfc: line 31

Zac Spitzer 24 March 2021 at 11:03
Edited

that’s a start, but that means we have the parameters now twice in the debug logs

I want the parameterised sql (so I can group by sql parameterised statement), then we only merge them together when rendering out the logs (if they are rendered)

https://github.com/lucee/Lucee/blob/6.0/core/src/main/java/lucee/runtime/debug/DebuggerImpl.java#L437

Pothys - MitrahSoft 24 March 2021 at 10:35
Edited

, I added a fix to show the query params in debugging datasource information.

Pull Request: https://github.com/lucee/Lucee/pull/1246

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Priority

Created 21 March 2021 at 18:04
Updated 6 March 2025 at 11:28

Flag notifications