From c2b97ea4242591198c0a82097858d67b7ef2620b Mon Sep 17 00:00:00 2001 From: "Dr. David A. Kunz" Date: Tue, 3 Sep 2024 15:17:35 +0200 Subject: [PATCH] fix(HANA): wrong falsy checks for vals in list optimization --- hana/lib/HANAService.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hana/lib/HANAService.js b/hana/lib/HANAService.js index d7c16dd07..80e6ba28c 100644 --- a/hana/lib/HANAService.js +++ b/hana/lib/HANAService.js @@ -979,13 +979,13 @@ class HANAService extends SQLService { list(list) { const first = list.list[0] // If the list only contains of lists it is replaced with a json function and a placeholder - if (this.values && first.list && !first.list.find(v => !v.val)) { + if (this.values && first.list && !first.list.find(v => v.val == null)) { const extraction = first.list.map((v, i) => `"${i}" ${this.constructor.InsertTypeMap[typeof v.val]()} PATH '$.V${i}'`) this.values.push(JSON.stringify(list.list.map(l => l.list.reduce((l, c, i) => { l[`V${i}`] = c.val; return l }, {})))) return `(SELECT * FROM JSON_TABLE(?, '$' COLUMNS(${extraction})))` } // If the list only contains of vals it is replaced with a json function and a placeholder - if (this.values && first.val) { + if (this.values && first.val != null) { const v = first const extraction = `"val" ${this.constructor.InsertTypeMap[typeof v.val]()} PATH '$.val'` this.values.push(JSON.stringify(list.list)) @@ -1111,6 +1111,7 @@ class HANAService extends SQLService { // JavaScript types string: () => `NVARCHAR(2147483647)`, number: () => `DOUBLE`, + boolean: () => `NVARCHAR(5)`, // HANA types 'cds.hana.TINYINT': () => 'INT',