jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1540844 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/query/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/
Date Mon, 11 Nov 2013 21:02:13 GMT
Author: jukka
Date: Mon Nov 11 21:02:13 2013
New Revision: 1540844

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

Skip the selector name in wildcard columns for XPath queries.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
    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/QueryEngineImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java?rev=1540844&r1=1540843&r2=1540844&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
Mon Nov 11 21:02:13 2013
@@ -108,6 +108,8 @@ public abstract class QueryEngineImpl im
             String sql2 = converter.convert(statement);
             LOG.debug("XPath > SQL2: {}", sql2);
             try {
+                // OAK-874: No artificial XPath selector name in wildcards
+                parser.setIncludeSelectorNameInWildcardColumns(false);
                 return parser.parse(sql2);
             } catch (ParseException e) {
                 ParseException e2 = new ParseException(

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=1540844&r1=1540843&r2=1540844&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 21:02:13 2013
@@ -95,6 +95,7 @@ public class SQL2Parser {
     // SQL injection protection: if disabled, literals are not allowed
     private boolean allowTextLiterals = true;
     private boolean allowNumberLiterals = true;
+    private boolean includeSelectorNameInWildcardColumns = true;
 
     private final AstElementFactory factory = new AstElementFactory();
 
@@ -860,7 +861,12 @@ public class SQL2Parser {
             if (namePathMapper != null) {
                 propertyName = namePathMapper.getJcrName(propertyName);
             }
-            String columnName = selectorName + "." + propertyName;
+            String columnName;
+            if (includeSelectorNameInWildcardColumns) {
+                columnName = selectorName + "." + propertyName;
+            } else {
+                columnName = propertyName;
+            }
             columns.add(factory.column(selectorName, propertyName, columnName));
         }
     }
@@ -1291,4 +1297,8 @@ public class SQL2Parser {
         this.allowNumberLiterals = allowNumberLiterals;
     }
 
+    public void setIncludeSelectorNameInWildcardColumns(boolean value) {
+        this.includeSelectorNameInWildcardColumns = value;
+    }
+
 }

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=1540844&r1=1540843&r2=1540844&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 21:02:13 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", "a.jcr:primaryType"),
+                newHashSet("jcr:path", "jcr:score", "jcr:primaryType"),
                 newHashSet(r.getColumnNames()));
     }
 



Mime
View raw message