jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1358172 - in /jackrabbit/oak/trunk/oak-jcr: ./ src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ src/test/java/org/apache/jackrabbit/oak/jcr/query/
Date Fri, 06 Jul 2012 12:51:10 GMT
Author: thomasm
Date: Fri Jul  6 12:51:10 2012
New Revision: 1358172

URL: http://svn.apache.org/viewvc?rev=1358172&view=rev
Log:
OAK-155 Query: limited support for the deprecated JCR 1.0 query language Query.SQL

Modified:
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ColumnImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/OrderingImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QOMNode.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/SelectorImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1358172&r1=1358171&r2=1358172&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Fri Jul  6 12:51:10 2012
@@ -82,7 +82,6 @@ org.apache.jackrabbit.test.api.Lifecycle
 org.apache.jackrabbit.test.api.query.GetPropertyNamesTest#testGetPropertyNames
 org.apache.jackrabbit.test.api.query.SaveTest#testConstraintViolationException
 org.apache.jackrabbit.test.api.query.SimpleSelectionTest#testSingleProperty
-org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testMultiValueSearch
 org.apache.jackrabbit.test.api.query.qom.ColumnTest#testExpandColumnsForNodeType
 org.apache.jackrabbit.test.api.query.qom.SelectorTest#testUnknownNodeType
 org.apache.jackrabbit.test.api.util

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ColumnImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ColumnImpl.java?rev=1358172&r1=1358171&r2=1358172&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ColumnImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/ColumnImpl.java
Fri Jul  6 12:51:10 2012
@@ -53,9 +53,8 @@ public class ColumnImpl extends QOMNode 
         if (propertyName != null) {
             return getSelectorName() + '.' + getPropertyName()
                     + " AS [" + columnName + "]";
-        } else {
-            return getSelectorName() + ".*";
         }
+        return getSelectorName() + ".*";
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java?rev=1358172&r1=1358171&r2=1358172&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/Operator.java
Fri Jul  6 12:51:10 2012
@@ -97,9 +97,8 @@ public enum Operator {
     public String formatXpath(String a, String b) {
         if (this == LIKE) {
             return "jcr:like(" + a + ", " + b + ')';
-        } else {
-            return a + ' ' + xpath + ' ' + b;
         }
+        return a + ' ' + xpath + ' ' + b;
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/OrderingImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/OrderingImpl.java?rev=1358172&r1=1358171&r2=1358172&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/OrderingImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/OrderingImpl.java
Fri Jul  6 12:51:10 2012
@@ -47,9 +47,8 @@ public class OrderingImpl extends QOMNod
     public String toString() {
         if (order == Order.ASCENDING) {
             return operand + " ASC";
-        } else {
-            return operand + " DESC";
         }
+        return operand + " DESC";
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QOMNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QOMNode.java?rev=1358172&r1=1358171&r2=1358172&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QOMNode.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QOMNode.java
Fri Jul  6 12:51:10 2012
@@ -24,9 +24,8 @@ abstract class QOMNode {
         String str = expression.toString();
         if (str.indexOf(' ') >= 0) {
             return '(' + str + ')';
-        } else {
-            return str;
         }
+        return str;
     }
 
     protected String quotePath(String path) {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/SelectorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/SelectorImpl.java?rev=1358172&r1=1358171&r2=1358172&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/SelectorImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/SelectorImpl.java
Fri Jul  6 12:51:10 2012
@@ -44,7 +44,6 @@ public class SelectorImpl extends Source
 
     @Override
     public String toString() {
-        // TODO quote nodeTypeName?
         return "[" + nodeTypeName + "] AS " + getSelectorName();
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java?rev=1358172&r1=1358171&r2=1358172&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
Fri Jul  6 12:51:10 2012
@@ -45,6 +45,7 @@ public class QueryTest extends AbstractR
         logout();
     }
 
+    @SuppressWarnings("deprecation")
     @Test
     public void simple() throws RepositoryException {
         Session session = createAnonymousSession();
@@ -57,6 +58,9 @@ public class QueryTest extends AbstractR
             ValueFactory vf = session.getValueFactory();
 
             QueryManager qm = session.getWorkspace().getQueryManager();
+
+            // SQL-2
+
             Query q = qm.createQuery("select text from [nt:base] where id = $id", Query.JCR_SQL2);
             q.bindValue("id", vf.createValue("1"));
             QueryResult r = q.execute();
@@ -73,6 +77,16 @@ public class QueryTest extends AbstractR
             assertEquals("hello world", n.getProperty("text").getString());
             assertFalse(it.hasNext());
 
+            // SQL
+
+            q = qm.createQuery("select text from [nt:base] where id = 1", Query.SQL);
+            q.execute();
+
+            // XPath
+
+            q = qm.createQuery("//*[@id=1]", Query.XPATH);
+            q.execute();
+
         } finally {
             session.logout();
         }



Mime
View raw message