From 5b99955ef0a305530cdfbd3c6cbf1218265117f6 Mon Sep 17 00:00:00 2001 From: Otavio Jacobi Date: Mon, 13 Jan 2025 11:12:03 -0300 Subject: [PATCH] Parse `in` bindings as a single list binding Change-type: major --- package.json | 2 +- src/odata-to-abstract-sql.ts | 2 +- test/filterby.js | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5424d34..25a096c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "license": "BSD", "dependencies": { "@balena/abstract-sql-compiler": "^10.0.1", - "@balena/odata-parser": "^3.1.0", + "@balena/odata-parser": "4.0.0-build-in-with-single-array-bind-d19b60e5320e839cbf626e1e1cb9ac019adf86bb-1", "@types/lodash": "^4.17.10", "@types/memoizee": "^0.4.11", "@types/string-hash": "^1.1.3", diff --git a/src/odata-to-abstract-sql.ts b/src/odata-to-abstract-sql.ts index 64c7d01..cc5f8a6 100644 --- a/src/odata-to-abstract-sql.ts +++ b/src/odata-to-abstract-sql.ts @@ -1171,7 +1171,7 @@ export class OData2AbstractSQL { return [ 'In', this.Operand(rest[0]), - ...rest[1].map((v: any) => this.Operand(v)), + this.Operand(rest[1]), ] as InNode; } case 'call': { diff --git a/test/filterby.js b/test/filterby.js index 5bd5e3c..7eb10fc 100644 --- a/test/filterby.js +++ b/test/filterby.js @@ -73,9 +73,7 @@ const createExpression = function (lhs, op, rhs) { if (op === 'in') { return { odata: operandToOData(lhs) + ' ' + op + ' ' + operandToOData(rhs), - abstractsql: [sqlOps[op], operandToAbstractSQL(lhs)].concat( - operandToAbstractSQL(rhs), - ), + abstractsql: [sqlOps[op], operandToAbstractSQL(lhs), ['Bind', 0]], }; } if (rhs == null) {