jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rakesh Vidyadharan <rak...@sptci.com>
Subject Re: Equivalent JCR_SQL2 statement
Date Mon, 09 Nov 2009 13:32:54 GMT
On 9 Nov 2009, at 1:36:25 AM, Thomas Müller wrote:

> Hi,
>
> I found the relevant section of the spec:
> http://www.day.com/specs/jcr/2.0/6_Query.html#6.7.4%20Name
> Name ::= '[' quotedName ']' | '[' simpleName ']' | simpleName
> simpleName ::= /* A JCR Name that is also a legal SQL identifier  */
> See the SQL:92 rules for <regular identifier> (in ISO/IEC 9075:1992 §
> 5.2 <token> and <separator>).
> As far as I read the SQL-92 spec, this basically means the same rules
> as for Java identifiers apply.

Just to clarify, I tried the following variants of the query:

select * from ['nt:unstructured'] where ['jcr:path'] like '/%/ 
unitTestPage' and ['cms:nodeType'] = 'page'
select * from [nt:unstructured] where [jcr:path] like '/%/ 
unitTestPage' and [cms:nodeType] = 'page'

Rakesh
>
>
>
> On Mon, Nov 9, 2009 at 8:20 AM, Thomas Müller  
> <thomas.mueller@day.com> wrote:
>> Hi,
>>
>> Try:
>>
>> select * from [nt:unstructured] where [jcr:path] like
>> '/%/unitTestPage' and [cms:nodeType] = 'page'
>>
>> Regards,
>> Thomas
>>
>>
>> On Sun, Nov 8, 2009 at 5:30 AM, Rakesh Vidyadharan  
>> <rakesh@sptci.com> wrote:
>>> Since XPath is deprecated in JCR 2.0, I am trying to move to  
>>> JCR_SQL2
>>> (JR-2.0-beta1).  I have the following XPath query:
>>>
>>> //unitTestPage[@cms:nodeType = 'page']
>>>
>>> I tried writing the query in SQL as:
>>>
>>> select * from nt:unstructured where jcr:path like '/%/ 
>>> unitTestPage' and
>>> cms:nodeType = 'page'
>>>
>>> This statement however fails with an exception:
>>>
>>> javax.jcr.query.InvalidQueryException: Query:
>>> select * from nt:(*)unstructured where jcr:path like '/%/ 
>>> unitTestFolder' and
>>> cms:nodeType = 'page'; expected: <end>
>>>        at
>>> org.apache.jackrabbit.commons.query.sql2.Parser.getSyntaxError 
>>> (Parser.java:968)
>>>        at
>>> org.apache.jackrabbit.commons.query.sql2 
>>> .Parser.createQueryObjectModel(Parser.java:124)
>>>        at
>>> org.apache.jackrabbit.commons.query.sql2 
>>> .SQL2QOMBuilder.createQueryObjectModel(SQL2QOMBuilder.java:55)
>>>        at
>>> org.apache.jackrabbit.core.query.QOMQueryFactory.createQuery 
>>> (QOMQueryFactory.java:69)
>>>        at
>>> org.apache.jackrabbit.core.query.CompoundQueryFactory.createQuery 
>>> (CompoundQueryFactory.java:67)
>>>        at
>>> org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery 
>>> (QueryManagerImpl.java:98)
>>>
>>> Can some one tell me what I am missing?
>>>
>>> Thanks
>>> Rakesh
>>>
>>>
>>>
>>

Rakesh Vidyadharan
President & CEO
Sans Pareil Technologies, Inc.
http://sptci.com/


| 100 W. Chestnut, Suite 1305 | Chicago, IL 60610-3296 USA |
| Ph: +1 (312) 212 3933 | Mobile: +1 (312) 315-1596 (US), +91  949 611  
0873 (IN) | Fax: +1 (312) 276-4410 | E-mail: rakesh@sptci.com





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message