From e87310338bac5f3205b60cacb9eb1b3bbbd1ff9d Mon Sep 17 00:00:00 2001 From: "Dr. David A. Kunz" Date: Wed, 23 Oct 2024 11:15:40 +0200 Subject: [PATCH 1/2] . --- test/compliance/SELECT.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/compliance/SELECT.test.js b/test/compliance/SELECT.test.js index aeeba8b21..7a51129e5 100644 --- a/test/compliance/SELECT.test.js +++ b/test/compliance/SELECT.test.js @@ -306,6 +306,12 @@ describe('SELECT', () => { assert.strictEqual(timestampMatches.length, 1, 'Ensure that the dateTime column matches the timestamp value') }) + test('combine expr with nested functions and other compare', async () => { + const { string } = cds.entities('basic.literals') + const res = await cds.run(CQL`SELECT string FROM ${string} WHERE string != ${'foo'} and contains(tolower(string),tolower(${'bar'}))`) + assert.strictEqual(res.length, 0, 'Ensure that no row is coming back') + }) + test('combine expr and other compare', async () => { const { globals } = cds.entities('basic.literals') const res = await cds.run(CQL`SELECT bool FROM ${globals} WHERE (bool != ${true}) and bool = ${false}`) From ec6309308539bcf389a17eee04b0ef1bd20cd17c Mon Sep 17 00:00:00 2001 From: Bob den Os Date: Wed, 23 Oct 2024 11:22:44 +0200 Subject: [PATCH 2/2] Only call toUppserCase when defined --- hana/lib/HANAService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hana/lib/HANAService.js b/hana/lib/HANAService.js index 801a11253..9cdf165b1 100644 --- a/hana/lib/HANAService.js +++ b/hana/lib/HANAService.js @@ -959,7 +959,7 @@ SELECT ${mixing} FROM JSON_TABLE(SRC.JSON, '$' COLUMNS(${extraction})) AS NEW LE // When it is a local check it cannot be compared outside of the xpr if (up in logicOperators) { // ensure AND is not part of BETWEEN - if (up === 'AND' && xpr[i - 2]?.toUpperCase() in { 'BETWEEN': 1, 'NOT BETWEEN': 1 }) return true + if (up === 'AND' && xpr[i - 2]?.toUpperCase?.() in { 'BETWEEN': 1, 'NOT BETWEEN': 1 }) return true return !local } // When a compare operator is found the expression is a comparison