phpcr / phpcr-utils

A set of helper classes and command line commands you want to use with phpcr, but that are not part of the API itself
phpcr.github.io
Other
72 stars 30 forks source link

SqlGenerator and the square brackets #13

Closed dbu closed 11 years ago

dbu commented 12 years ago

moved from https://github.com/phpcr/phpcr/issues/21

When using the QOM, the user should not need to know about escaping in SQL2. But when you do something like the following you still need the brackets:

$qomFactory->fulltextSearch('title', 'The', '[nt:unstructured]');

Without square brackets jackrabbit throws:

HTTP 400: Query:
SELECT * FROM [nt:unstructured] WHERE CONTAINS(nt:(*)unstructured.title, 'Team') AND [phpcr:class] = 'Sandbox\MainBundle\Document\EditableStaticContent' ORDER BY path ASC; expected: ,

looking through this https://github.com/phpcr/phpcr-utils/blob/master/src/PHPCR/Util/QOM/Sql2Generator.php i see many places where a name without [] is created. maybe we need more validation too. QueryBuilder seems to expect namespaced names whereas Sql2Generator seems to have 2 parameters if i understand correctly.

dbu commented 11 years ago

this is now fixed, or not?