jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1540828 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java oak-jcr/pom.xml oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
Date Mon, 11 Nov 2013 20:08:56 GMT
Author: jukka
Date: Mon Nov 11 20:08:55 2013
New Revision: 1540828

URL: http://svn.apache.org/r1540828
Log:
OAK-874: Column names aren't reported properly for "select * from [nodeType]" queries

Always include selector name in wildcard colum names for backwards compatibility with Jackrabbit
2.x

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java?rev=1540828&r1=1540827&r2=1540828&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
Mon Nov 11 20:08:55 2013
@@ -793,6 +793,10 @@ public class SQL2Parser {
                             column.propertyName = readName();
                             if (readIf("AS")) {
                                 column.columnName = readName();
+                            } else {
+                                column.columnName =
+                                        column.selectorName
+                                        + "." + column.propertyName;
                             }
                         }
                     } else {
@@ -837,12 +841,12 @@ public class SQL2Parser {
             throws ParseException {
         if (selectorName == null) {
             for (SelectorImpl selector : selectors.values()) {
-                addWildcardColumns(columns, selector, selectors.size() > 1);
+                addWildcardColumns(columns, selector);
             }
         } else {
             SelectorImpl selector = selectors.get(selectorName);
             if (selector != null) {
-                addWildcardColumns(columns, selector, true);
+                addWildcardColumns(columns, selector);
             } else {
                 throw getSyntaxError("Unknown selector: " + selectorName);
             }
@@ -850,18 +854,14 @@ public class SQL2Parser {
     }
 
     private void addWildcardColumns(
-            Collection<ColumnImpl> columns, SelectorImpl selector,
-            boolean includeSelectorName) {
+            Collection<ColumnImpl> columns, SelectorImpl selector) {
         String selectorName = selector.getSelectorName();
-        for (String property : selector.getWildcardColumns()) {
+        for (String propertyName : selector.getWildcardColumns()) {
             if (namePathMapper != null) {
-                property = namePathMapper.getJcrName(property);
+                propertyName = namePathMapper.getJcrName(propertyName);
             }
-            String columnName = property;
-            if (includeSelectorName) {
-                columnName = selectorName + "." + property;
-            }
-            columns.add(factory.column(selectorName, property, columnName));
+            String columnName = selectorName + "." + propertyName;
+            columns.add(factory.column(selectorName, propertyName, columnName));
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1540828&r1=1540827&r2=1540828&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Mon Nov 11 20:08:55 2013
@@ -149,7 +149,6 @@
       org.apache.jackrabbit.core.query.XPathAxisTest#testIndex1Descendant               
            <!-- OAK-322 -->
       org.apache.jackrabbit.core.query.XPathAxisTest#testIndex2Descendant               
            <!-- OAK-322 -->
       org.apache.jackrabbit.core.query.XPathAxisTest#testIndex3Descendant               
            <!-- OAK-322 -->
-      org.apache.jackrabbit.core.query.SQL2QueryResultTest#testSQL2SelectColums         
            <!-- OAK-874 -->
       org.apache.jackrabbit.core.query.SimpleQueryTest#testGeneralComparison            
            <!-- OAK-327 -->
       org.apache.jackrabbit.core.query.FnNameQueryTest#testLikeWithPrefix               
            <!-- OAK-328 -->
       org.apache.jackrabbit.core.query.UpperLowerCaseQueryTest#testInvalidQuery         
            <!-- OAK-329 -->

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=1540828&r1=1540827&r2=1540828&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
Mon Nov 11 20:08:55 2013
@@ -188,7 +188,7 @@ public class QueryTest extends AbstractR
         q = qm.createQuery("//*[@id=1]", Query.XPATH);
         r = q.execute();
         assertEquals(
-                newHashSet("jcr:path", "jcr:score", "jcr:primaryType"),
+                newHashSet("jcr:path", "jcr:score", "a.jcr:primaryType"),
                 newHashSet(r.getColumnNames()));
     }
 



Mime
View raw message