Skip to content

Commit

Permalink
Parse in bindings as a single list binding
Browse files Browse the repository at this point in the history
Change-type: major
  • Loading branch information
otaviojacobi committed Jan 13, 2025
1 parent 31da05d commit d8e0166
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/odata-to-abstract-sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
5 changes: 2 additions & 3 deletions test/filterby.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -131,6 +129,7 @@ const operandTest = (lhs, op, rhs) =>
const { odata, abstractsql } = createExpression(lhs, op, rhs);
test('/pilot?$filter=' + odata, (result) =>
it('should select from pilot where "' + odata + '"', () => {
console.log('result is', JSON.stringify(result));
expect(result)
.to.be.a.query.that.selects(pilotFields)
.from('pilot')
Expand Down

0 comments on commit d8e0166

Please sign in to comment.