chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r928013 - in /incubator/chemistry/trunk/chemistry/chemistry-commons/src: main/antlr3/org/apache/chemistry/cmissql/ main/antlr3/org/apache/chemistry/impl/simple/ main/java/org/apache/chemistry/impl/simple/ test/gunit/org/apache/chemistry/cmi...
Date Fri, 26 Mar 2010 18:50:27 GMT
Author: fguillaume
Date: Fri Mar 26 18:50:27 2010
New Revision: 928013

URL: http://svn.apache.org/viewvc?rev=928013&view=rev
Log:
CMIS-185: Add SELECT DISTINCT extension to CMISQL parser

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlLexer.g
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlParser.g
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/impl/simple/CmisSqlSimpleWalker.g
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/gunit/org/apache/chemistry/cmissql/CmisSql.testsuite

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlLexer.g
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlLexer.g?rev=928013&r1=928012&r2=928013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlLexer.g
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlLexer.g
Fri Mar 26 18:50:27 2010
@@ -63,6 +63,7 @@ package org.apache.chemistry.cmissql;
 // ----- Generic SQL -----
 
 SELECT : ('S'|'s')('E'|'e')('L'|'l')('E'|'e')('C'|'c')('T'|'t');
+DISTINCT : ('D'|'d')('I'|'i')('S'|'s')('T'|'t')('I'|'i')('N'|'n')('C'|'c')('T'|'t');
 FROM : ('F'|'f')('R'|'r')('O'|'o')('M'|'m');
 AS : ('A'|'a')('S'|'s');
 JOIN : ('J'|'j')('O'|'o')('I'|'i')('N'|'n');

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlParser.g
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlParser.g?rev=928013&r1=928012&r2=928013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlParser.g
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/cmissql/CmisSqlParser.g
Fri Mar 26 18:50:27 2010
@@ -64,7 +64,7 @@ package org.apache.chemistry.cmissql;
     }
 }
 
-query: SELECT^ select_list from_clause where_clause? order_by_clause?;
+query: SELECT^ DISTINCT? select_list from_clause where_clause? order_by_clause?;
 
 select_list
     : STAR

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/impl/simple/CmisSqlSimpleWalker.g
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/impl/simple/CmisSqlSimpleWalker.g?rev=928013&r1=928012&r2=928013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/impl/simple/CmisSqlSimpleWalker.g
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/impl/simple/CmisSqlSimpleWalker.g
Fri Mar 26 18:50:27 2010
@@ -77,8 +77,9 @@ query [SimpleData d, SimpleConnection co
     data = $d;
     connection = $conn;
 }:
-    ^(SELECT select_list from_clause where_clause order_by_clause?)
+    ^(SELECT DISTINCT? select_list from_clause where_clause order_by_clause?)
     {
+        // TODO distinct
         $tableName = $from_clause.tableName;
         $matches = $where_clause.matches;
     }

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java?rev=928013&r1=928012&r2=928013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java
Fri Mar 26 18:50:27 2010
@@ -99,11 +99,11 @@ public class SimpleObjectEntry implement
 
     // TODO add a getPath method to the SPI
     protected String getPath(Connection connection) {
+        if (getId() == null) {
+            return null;
+        }
         ObjectEntry parent;
         if (getBaseType() == BaseType.FOLDER) {
-            if (getId() == null) {
-                return null;
-            }
             parent = connection.getSPI().getFolderParent(this, null);
         } else {
             Collection<ObjectEntry> parents = connection.getSPI().getObjectParents(

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/gunit/org/apache/chemistry/cmissql/CmisSql.testsuite
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/gunit/org/apache/chemistry/cmissql/CmisSql.testsuite?rev=928013&r1=928012&r2=928013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/gunit/org/apache/chemistry/cmissql/CmisSql.testsuite
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/gunit/org/apache/chemistry/cmissql/CmisSql.testsuite
Fri Mar 26 18:50:27 2010
@@ -150,6 +150,7 @@ query:
 "SELECT * FROM Document" -> (SELECT * (FROM (TABLE Document)))
 "SELECT a, b, c FROM Document" -> (SELECT (LIST (COL a) (COL b) (COL c)) (FROM (TABLE
Document)))
 "SELECT a, b FROM Document ORDER BY a, b" -> (SELECT (LIST (COL a) (COL b)) (FROM (TABLE
Document)) (ORDER_BY (COL a) ASC (COL b) ASC))
+"SELECT DISTINCT a, b, c FROM Document" -> (SELECT DISTINCT (LIST (COL a) (COL b) (COL
c)) (FROM (TABLE Document)))
 
 
 // Examples from the specs.



Mime
View raw message