jetstreamapp / soql-parser-js

Javascript SOQL parser
https://jetstreamapp.github.io/soql-parser-js/
MIT License
79 stars 20 forks source link

NOT (field expression) fails to parse #122 #123

Closed paustint closed 4 years ago

paustint commented 4 years ago

Added failing unit tests fixed parser to account for NOT prior to parentheses

TODO

The way the data model and parser is setup, there is not a good way to distinguish the following cases: SELECT AnnualRevenue FROM Account WHERE NOT (AnnualRevenue > 0 AND AnnualRevenue < 200000) LIMIT 1 SELECT AnnualRevenue FROM Account WHERE ((NOT AnnualRevenue > 0) AND AnnualRevenue < 200000) LIMIT 1

EDIT

This bug will likely require some changes to the data model and will require changes to parsing and visiting nodes to account for a valid query like this SELECT Id FROM Account WHERE ((NOT (Name = '2' OR Name = '3'))) with the ability to compose back into soql.

resolves #122

Here is how this is handled by mulesoft's Java implementation: image