Issue Details (XML | Word | Printable)

Key: GROOVY-1550
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Paul King
Reporter: Jon Skeet
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
groovy

Groovy Sql (or AST builder) doesn't respect bracketing of logical operators

Created: 06/Nov/06 04:10 PM   Updated: 26/Sep/07 08:29 PM
Component/s: ast builder
Affects Version/s: 1.0-JSR-6, 1.0-RC-1
Fix Version/s: 1.1-beta-2

Time Tracking:
Not Specified

Environment: Windows, HSQLDB

Testcase included: yes


 Description  « Hide
Version used: both JSR-6 and the snapshot downloaded today in the Grails 0.3 snapshot.

(AST builder selected as a component on the grounds that I'm not sure whether it's in Groovy SQL or AST.)

Groovy SQL should take note of the brackets in expressions which are presumably in the AST somewhere.

For instance, DataSet.findAll { it.x=='zzz' && (it.y==20 || it.x=='xxx') } should generate SQL of:

select * from Test where x = ? and (y = ? or x = ?)

but there are no brackets in the generated SQL. This means that in the attached test case, a row is found, despite the fact that it shouldn't be. (x can't be both zzz and xxx).

(Attachment isn't a JUnit test case - it's a Groovy script with a failing assertion)



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Paul King added a comment - 24/Jun/07 05:40 AM
Jon, you still have the attachment? It doesn't seem to be here at the moment.

Jon Skeet added a comment - 24/Jun/07 04:15 PM
Unfortunately not - I've changed job and reinstalled my laptop since then

Jon


Paul King added a comment - 28/Jun/07 10:16 PM
Should be fixed in HEAD

Paul King added a comment - 26/Sep/07 08:29 PM
No further feedback, assuming fixed