chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1178451 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src: main/antlr3/org/apache/chemistry/opencmis/server/support/query/ test/java/org/apache/chemistry/opencmis/server/support/query/
Date Mon, 03 Oct 2011 16:53:30 GMT
Author: jens
Date: Mon Oct  3 16:53:30 2011
New Revision: 1178451

URL: http://svn.apache.org/viewvc?rev=1178451&view=rev
Log:
Allow escaping of _ and % characters for LIKE string literals

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g?rev=1178451&r1=1178450&r2=1178451&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
Mon Oct  3 16:53:30 2011
@@ -128,12 +128,14 @@ NUM_LIT : Sign (ExactNumLit | ApproxNumL
 
 fragment QUOTE: '\'';
 fragment BACKSL: '\\';
+fragment UNDERSCORE: '_';
+fragment PERCENT: '%';
 
 // An escape sequence is two backslashes for backslash, backslash single quote for single
quote
 // or single quote single quote for single quote
 fragment
 ESC 
-	: BACKSL (QUOTE | BACKSL)
+	: BACKSL (QUOTE | BACKSL | PERCENT | UNDERSCORE)
 	| QUOTE QUOTE
 	;
 	

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java?rev=1178451&r1=1178450&r2=1178451&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java
Mon Oct  3 16:53:30 2011
@@ -283,6 +283,26 @@ public class TestParserStrict extends Ab
     public void testSTRING_LIT8() throws Exception {
         testLexerOk("STRING_LIT", "'c:\\\\temp'");
     }
+    
+    @Test
+    public void testSTRING_LIT9() throws Exception {
+        testLexerOk("STRING_LIT", "'Like%String'");
+    }
+    
+    @Test
+    public void testSTRING_LIT10() throws Exception {
+        testLexerOk("STRING_LIT", "'Like_String'");
+    }
+    
+    @Test
+    public void testSTRING_LIT11() throws Exception {
+        testLexerOk("STRING_LIT", "'Like\\%String'");
+    }
+    
+    @Test
+    public void testSTRING_LIT12() throws Exception {
+        testLexerOk("STRING_LIT", "'Like\\_String'");
+    }
 
 
 //    BOOL_LIT:
@@ -737,4 +757,12 @@ public class TestParserStrict extends Ab
                 "FROM TRAVEL_BROCHURE " +
                 "WHERE ( CONTAINS('CARIBBEAN CENTRAL AMERICA CRUISE TOUR') ) AND( '2010-1-1'
= ANY DEPARTURE_DATES )");
     }
+    
+    @Test
+    public void queryEsc1() throws Exception {
+        testParserOk("query",
+                "SELECT * FROM cmis:document " +
+                "WHERE cmis:name LIKE 'abc\\%'");
+    }
+    
 }



Mime
View raw message