Issues
- Query Params are not Resolved When Query has Question MarkLDEV-4424Michael Offner
- Regression - sameFormFieldsAsArray = false append the empty valuesLDEV-3909Resolved issue: LDEV-3909Michael Offner
- <cfstoredproc /> is not returning correct exception when MSSQL when raiserror() is usedLDEV-3908Resolved issue: LDEV-3908Michael Offner
Query Params are not Resolved When Query has Question Mark
Description
Environment
is caused by
relates to
Details
Assignee
Michael OffnerMichael OffnerReporter
Timothy LuxTimothy LuxPriority
CriticalNew 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
Affects versions
Details
Details
Assignee
Reporter
Priority
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
Affects versions
Activity
Zac Spitzer26 July 2024 at 16:12Edited
It's a question of priorities, sure it breaks but the provided example doesn't seem that critical (i.e using a special character in a column name)
I've already spent a lot of time on the linked tickets which solves real problems, this is an edge case which solving would add overhead to all queries Lucee executes, i know there’s some postgres syntax which is related, but that’s a somewhat different story
Timothy Lux26 July 2024 at 14:53
You want to solve this because why... because it's hard? Because you erroneously believe a use case is “limited”? I provided an example that breaks under your code. seems like you should fix that.
Zac Spitzer26 July 2024 at 14:41Edited
this contrived example is quite challenging, we could ignore ?, dos the column name really need to be [county/Entity?]
because currently we reparse the output sql for debugging or logging to datasource log, it becomes quite problematic, unless we store the source sql as well, logging to datasource isn’t such a problem, as that’s done immediately, but debug logs can potentially hang around for a long time before they are fetched and rendered on demand
escaping the ? with ?? i can make the queryParamConverter handle [county/Entity??] but that breaks the debug / logging rendering,
if i change it to ? on the preparse, leaving it in as ?? makes the column name becomes county/Entity?? which is also suboptimal
I’d like to solve this, but this current example seems more trouble than it’s worth?
I have a pending patch for and but that doesn’t make any difference here, I did try tweaking that code locally, to no avail
Zac Spitzer29 March 2023 at 11:22
Pothys - MitrahSoft17 March 2023 at 15:30Edited
I've checked this ticket and confirmed the issue happened on the lucee latest version 5.4.0.37-SNAPSHOT.
Using the sql with '?' and queryParam throws error like there are more question marks in the SQL than params defined.
the regression starts from 5.3.9.70-SNAPSHOT and this commit causes to the issue
this error is occurred in the _doEndTag() method on query tag class after the query execution completed.
That error occurred while trying to log the query details to datasource.log here
So if I set the log level to trace for the datasource.log then the error is not occurred. The cfquery runs fine and I can confirm this by dump the result attribute value.
But If I try to dump the query result the same error thrown from the dump.cfc file. Please see the both stacktrace.
I added the testcase to this ticket
Pull Request:
Stacktrace
Stacktrace from the dump.cfc
mentioned queries with comments; but several comments on this story that match our use case were unresolved from this fix.
Running the following query will result in the error “there are more question marks in the SQL than params defined in the SQL String”:
If the declare @orgID line is commented out, so no params are sent with the query, then the query will run successfully.
This was working in 5.2.9.31.
I confirmed this query will not run in 5.3.10.125-SNAPSHOT
I confirmed I cannot escape that ? to get it to run successfully.