On Thu, Jun 17, 2010 at 3:12 PM, Jens Hübel <[email protected]> wrote:
> I am confused about the spec regarding query with multi-value properties. I 
> understand that a plain IN is only another syntax for OR and restricted to 
> single value properties:
> WHERE myprop IN ['red', 'green', 'blue']

Yes. Note that you must use parentheses, not brackets:
WHERE myprop IN ('red', 'green', 'blue')

> The spec is also quite clear about IN ANY for multi-value properties:
> WHERE ANY mycolors in ['red', 'green', 'blue']
>  (matches if at least one of the values in mycolors is either red or green or 
> blue)
>
> But is there any difference to the following statement?
> WHERE 'red' = ANY mycolors
> Is it different to
> WHERE ANY mycolors in ['red']
>
> Is this only syntactic sugar?

You could say that the first one is syntactic sugar for the second,
but it's also much more common. Of course the second form allows
multiple elements in the list so is more powerful.

> Former versions of the spec have supported more operators (<, > etc. ) where 
> this might have made more sense?

Yes in former versions you could do:
WHERE 123 < ANY myintegers

And actually in the parser I think I still support it as it's a useful
extension and easy to implement for some backends.

Florent


-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Reply via email to