Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-JSR-6, 1.0-RC-1
-
None
-
Windows, HSQLDB
Description
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)