save query debugging parameterized (sql and params)
Description
Activity
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:
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 | |
Stacktrace | The Error Occurred in
called from /opt/lucee/tomcat/lucee-server/context/context/admin/debug/Classic.cfc: line 373 |
Zac Spitzer 24 March 2021 at 11:03Edited
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)
Pothys - MitrahSoft 24 March 2021 at 10:35Edited
@Michael Offner, @Zac Spitzer I added a fix to show the query params in debugging datasource information.
Pull Request: https://github.com/lucee/Lucee/pull/1246
Details
Assignee
Michael OffnerMichael OffnerReporter
Zac SpitzerZac SpitzerNew 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
New
Details
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
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