You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: re-write filter at from.at(-1) into queries where (#1373)
this is a preparation for #1361 and it also makes our lifes easier as
the infix filter at this place is semantically equivalent to a regular
`where` clause.
//(SMW) TODO I'd prefer to have the cond from the filter before the cond coming from the WHERE
75
-
// which, by the way, is the case in tests below where we have a path in FROM -> ???
76
74
it('handles infix filter at entity and WHERE clause',()=>{
77
-
letquery=cqn4sql(cds.ql`SELECT from bookshop.Books[price < 12.13] as Books {Books.ID} where stock < 11`,model)
75
+
letquery=cqn4sql(cds.ql`SELECT from bookshop.Books[price < 12.13 or true] as Books {Books.ID} where stock < 11`,model)
78
76
expect(query).to.deep.equal(
79
-
cds.ql`SELECT from bookshop.Books as Books {Books.ID} WHERE (Books.stock < 11) and (Books.price < 12.13)`,
77
+
cds.ql`SELECT from bookshop.Books as Books {Books.ID} WHERE (Books.price < 12.13 or true) and Books.stock < 11`,
80
78
)
81
79
})
82
80
83
-
//(SMW) TODO I'd prefer to have the cond from the filter before the cond coming from the WHERE
84
-
// which, by the way, is the case in tests below where we have a path in FROM -> ???
85
81
it('gets precedence right for infix filter at entity and WHERE clause',()=>{
86
82
letquery=cqn4sql(
87
83
cds.ql`SELECT from bookshop.Books[price < 12.13 or stock > 77] as Books {Books.ID} where stock < 11 or price > 17.89`,
88
84
model,
89
85
)
90
86
expect(query).to.deep.equal(
91
-
cds.ql`SELECT from bookshop.Books as Books {Books.ID} WHERE (Books.stock < 11 or Books.price > 17.89) and (Books.price < 12.13 or Books.stock > 77)`,
87
+
cds.ql`SELECT from bookshop.Books as Books {Books.ID} WHERE (Books.price < 12.13 or Books.stock > 77) and (Books.stock < 11 or Books.price > 17.89)`,
92
88
)
93
89
//expect (query) .to.deep.equal (cds.ql`SELECT from bookshop.Books as Books {Books.ID} WHERE (Books.price < 12.13 or Books.stock > 77) and (Books.stock < 11 or Books.price > 17.89)`) // (SMW) want this
0 commit comments