Closed dbu closed 9 years ago
hm, i guess this one we need to look into:
-CONTAINS(data.*, 'foo')
+CONTAINS(data.[*], 'foo')
@dantleech do you know how wildcards and [] interact?
tests need to be updated
tests need to be updated
i will wait for dan to tell whether [*] could be a problem.
I don't know, but using a wildcard in a name seems to be invalid anyway, at least with the jackrabbit transport:
\PHPCRSH > select * from [nt:unstructured] where CONTAINS(*, "nt:unstructured");
[PHPCR\Query\InvalidQueryException] HTTP 400: '*' not allowed in name
interesting:
> "SELECT * FROM [nt:unstructured] as a WHERE CONTAINS(a.*, 'foobar')"
Results:
> SELECT * FROM [nt:unstructured] as a WHERE CONTAINS(a.[*], 'foobar')
HTTP 400: '*' not allowed in name
> SELECT * FROM [nt:unstructured] as a WHERE CONTAINS(a.a*, 'foobar')
HTTP 400: SELECT * FROM [nt:unstructured] as a WHERE CONTAINS(a.a*(*), 'foobar'); expected: ,
> SELECT * FROM [nt:unstructured] as a WHERE CONTAINS(a.[a*], 'foobar')
HTTP 400: '*' not allowed in name
so it seems you can either say "any" with a wildcard and then there must be no brackets, or you can put the brackets to make sure its taken as a name. is there any other special thing we need to consider, other than *
? i think i can then just adapt my PR to check for '*' as a special case.
okay, special case for * added and updated the other tests. lets see
i just ran this with jackalope-jackrabbit and the phpcr-api-tests for the sql2 queries of course are missing a bunch of variations to allow the escaping, but otherwise no error.
if we agree that this is correct, i can do a PR against the api tests to allow the escaping.
this would be green and could be merged, but we would need to update the api tests.
@dantleech do you think this is correct? if so i can adapt the api tests to allow for the escaping.
My internet is currently awful, but isn't ?
a valid wildcard character too? Can we check the spec? Otherwise this is good for me (I guess properties with spaces also don't work currently).
both SELECT a.jcr:mi?in
and SELECT a.jcr:mi*
lead to parse errors. only a.* is legal, apart from explicit names.
i noticed that a property with hyphens fails otherwise. its valid to put [] around every property, so lets play it safe.