forrestzhu / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

JPASkipToken.parse does not parenthesize correctly #50

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
the comments at the top of the method show the correct parentheses but the 
returned BoolCommonExpression does not have them.

Original issue reported on code.google.com by tony.ro...@gmail.com on 23 Jun 2011 at 7:43

GoogleCodeExporter commented 8 years ago
Tony, can you elaborate on this?

Original comment by john.spurlock on 25 Jun 2011 at 4:44

GoogleCodeExporter commented 8 years ago
yeah, didn't really describe this very well:

example:
http://localhost:8886/JPAProducerExample.svc/Products?$format=json&$orderby=Unit
Price&$filter=UnitsOnOrder%20ge%200

this produces where clause of t0.UnitsOnOrder >= 0

__next is:
http://localhost:8886/JPAProducerExample.svc/Products?$format=json&$orderby=Unit
Price&$filter=UnitsOnOrder%20ge%200&$skiptoken=25.89M,30

that produces a where clause of  t0.UnitsOnOrder >= 0 AND t0.UnitPrice > 25.89 
OR t0.UnitPrice = 25.89 AND t0.ProductID > 30 which, by operator precedence, is 
evaluated: (A and B) or (C and D) when the desired logic is A and (B or (C and 
D))

so really it isn't *just* the fault of JPASkipToken.  I would just explicitly 
parenthesize the skip token predicate completely.

Original comment by tony.ro...@gmail.com on 27 Jun 2011 at 8:18

GoogleCodeExporter commented 8 years ago
fixed, added unit tests: JPASkipTokenTest.java

Original comment by tony.ro...@gmail.com on 9 Nov 2011 at 5:37