Fixed
Details
Assignee
Pothys - MitrahSoftPothys - MitrahSoftReporter
Brad WoodBrad WoodNew 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
NoneFix versions
Priority
New
Details
Details
Assignee
Pothys - MitrahSoft
Pothys - MitrahSoftReporter
Brad Wood
Brad WoodNew 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
None
Fix versions
Priority
Created 19 January 2022 at 19:02
Updated 18 September 2024 at 10:06
Resolved 16 May 2024 at 09:47
This SQL returns 1 matching row in MSSQL and Adobe CF QoQ:
employees = queryNew( 'name,foo', 'varchar,varchar',[ ['Brad','cm_4test5'], ['Luis','yeah'] ]); actual = QueryExecute( sql = "SELECT * from employees WHERE foo LIKE 'cm_[0-9]%[0-9]'", options = { dbtype: 'query' } ); writedump( actual );
Note, MySQL, Oracle, and Postgres do not support square bracket char sets in their LIKE operator.
This has potential backwards compat issues, so we need to also fix the escape character which currently does not work. The default escape char should be "\" and we should also support this syntax which is standard SQL:
WHERE col1 LIKE 'foo$%bar' ESCAPE '$'
Additional information. The square bracket char set works the same as regex. It matches a single character in the set or range of chars defined. Ex:
[abc] – Match a single char "a" or "b" or "c"
[0-9] – Match a single digit "0" through "9"
– match a single char NOT "x", "y", or "z"
Any existing code matching a literal square bracket such as
WHERE col1 LIKE 'foo[bar]baz%'
would need to update their code to the following to continue working after this change
WHERE col1 LIKE 'foo\[bar]baz%'
or-- if a custom escape char is preferred...
WHERE col1 LIKE 'foo@[bar]baz%' ESCAPE '@'