Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 21478 invoked from network); 9 Nov 2009 13:33:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Nov 2009 13:33:23 -0000 Received: (qmail 78802 invoked by uid 500); 9 Nov 2009 13:33:23 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 78775 invoked by uid 500); 9 Nov 2009 13:33:23 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 78764 invoked by uid 99); 9 Nov 2009 13:33:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Nov 2009 13:33:23 +0000 X-ASF-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE,URIBL_SBL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.64.63.171] (HELO mail.sptci.com) (208.64.63.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Nov 2009 13:33:16 +0000 Received: from localhost (localhost [127.0.0.1]) by localhost.sptci.com (Postfix) with ESMTP id BB2911D9A7 for ; Mon, 9 Nov 2009 05:32:56 -0800 (PST) X-Virus-Scanned: amavisd-new at sptci.com Received: from mail.sptci.com ([127.0.0.1]) by localhost (mail.sptci.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id vTKHD0h2N22t for ; Mon, 9 Nov 2009 05:32:56 -0800 (PST) Received: from www.rakeshv.org (unknown [64.81.229.247]) by mail.sptci.com (Postfix) with ESMTPSA id 980141D9A6 for ; Mon, 9 Nov 2009 05:32:55 -0800 (PST) From: Rakesh Vidyadharan Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: multipart/alternative; boundary=Apple-Mail-862-293500618 Subject: Re: Equivalent JCR_SQL2 statement Date: Mon, 9 Nov 2009 07:32:54 -0600 In-Reply-To: <91f3b2650911082336n8d50dc3oe08bf8348420682b@mail.gmail.com> To: users@jackrabbit.apache.org References: <91f3b2650911082320n4eb3d974w92b5b993268e503f@mail.gmail.com> <91f3b2650911082336n8d50dc3oe08bf8348420682b@mail.gmail.com> Message-Id: <1EF092A8-8EA5-4BE1-AB9F-4C2D8F8EE3C7@sptci.com> X-Mailer: Apple Mail (2.1076) --Apple-Mail-862-293500618 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1; format=flowed; delsp=yes On 9 Nov 2009, at 1:36:25 AM, Thomas M=FCller 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 ::=3D '[' quotedName ']' | '[' simpleName ']' | simpleName > simpleName ::=3D /* A JCR Name that is also a legal SQL identifier */ > See the SQL:92 rules for (in ISO/IEC 9075:1992 =A7 > 5.2 and ). > 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 '/%/=20 unitTestPage' and ['cms:nodeType'] =3D 'page' select * from [nt:unstructured] where [jcr:path] like '/%/=20 unitTestPage' and [cms:nodeType] =3D 'page' Rakesh > > > > On Mon, Nov 9, 2009 at 8:20 AM, Thomas M=FCller =20 > wrote: >> Hi, >> >> Try: >> >> select * from [nt:unstructured] where [jcr:path] like >> '/%/unitTestPage' and [cms:nodeType] =3D 'page' >> >> Regards, >> Thomas >> >> >> On Sun, Nov 8, 2009 at 5:30 AM, Rakesh Vidyadharan =20 >> wrote: >>> Since XPath is deprecated in JCR 2.0, I am trying to move to =20 >>> JCR_SQL2 >>> (JR-2.0-beta1). I have the following XPath query: >>> >>> //unitTestPage[@cms:nodeType =3D 'page'] >>> >>> I tried writing the query in SQL as: >>> >>> select * from nt:unstructured where jcr:path like '/%/=20 >>> unitTestPage' and >>> cms:nodeType =3D 'page' >>> >>> This statement however fails with an exception: >>> >>> javax.jcr.query.InvalidQueryException: Query: >>> select * from nt:(*)unstructured where jcr:path like '/%/=20 >>> unitTestFolder' and >>> cms:nodeType =3D 'page'; expected: >>> at >>> org.apache.jackrabbit.commons.query.sql2.Parser.getSyntaxError=20 >>> (Parser.java:968) >>> at >>> org.apache.jackrabbit.commons.query.sql2=20 >>> .Parser.createQueryObjectModel(Parser.java:124) >>> at >>> org.apache.jackrabbit.commons.query.sql2=20 >>> .SQL2QOMBuilder.createQueryObjectModel(SQL2QOMBuilder.java:55) >>> at >>> org.apache.jackrabbit.core.query.QOMQueryFactory.createQuery=20 >>> (QOMQueryFactory.java:69) >>> at >>> org.apache.jackrabbit.core.query.CompoundQueryFactory.createQuery=20 >>> (CompoundQueryFactory.java:67) >>> at >>> org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery=20 >>> (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 =20= 0873 (IN) | Fax: +1 (312) 276-4410 | E-mail: rakesh@sptci.com --Apple-Mail-862-293500618--