cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r964535 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/
Date Thu, 15 Jul 2010 18:46:31 GMT
Author: aadamchik
Date: Thu Jul 15 18:46:30 2010
New Revision: 964535

URL: http://svn.apache.org/viewvc?rev=964535&view=rev
Log:
CAY-1426 EJBQL: ESCAPE fails after positional parameter

* patch by Xenia Khailenko

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=964535&r1=964534&r2=964535&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Thu Jul 15 18:46:30 2010
@@ -67,6 +67,7 @@ CAY-1380 Support for Escaped LIKE Clause
 CAY-1402 Ability to use Terminating "@size" in Nested Properties Against Collections
 CAY-1416 ExpressionFactory.noMatchExp.toEJBQL() produces incorrect output
 CAY-1417 EJBQL doesn't support null numeric parameters 
+CAY-1426 EJBQL: ESCAPE fails after positional parameter
 CAY-1452 EJBQL query scalar result is not supported on ROP client
 CAY-1455 "NULL" JDBC type is shown for DbAttribute data types in the Modeler
 CAY-1458 Document Vertical Inheritance

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt?rev=964535&r1=964534&r2=964535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt
Thu Jul 15 18:46:30 2010
@@ -1208,7 +1208,7 @@ void positional_input_parameter() #Posit
 
 void pattern_value() #PatternValue : { }
 {
-	input_parameter() | string_literal()
+	(input_parameter() | string_literal())
 	[(<ESCAPE> escape_character())]
 }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java?rev=964535&r1=964534&r2=964535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
Thu Jul 15 18:46:30 2010
@@ -225,6 +225,27 @@ public class DataContextEJBQLConditionsT
         assertTrue(ids.contains(new Integer(33005)));
     }
 
+    public void testLikeEscape_LikeParameter() throws Exception {
+        createLikeDataSet();
+
+        // test for CAY-1426
+        String ejbql = "SELECT p FROM Painting p WHERE p.paintingTitle LIKE ?1 ESCAPE 'X'";
+
+        EJBQLQuery query = new EJBQLQuery(ejbql);
+        query.setParameter(1, "X_DDDD");
+        List<?> objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+
+        Set<Object> ids = new HashSet<Object>();
+        Iterator<?> it = objects.iterator();
+        while (it.hasNext()) {
+            Object id = Cayenne.pkForObject((Persistent) it.next());
+            ids.add(id);
+        }
+
+        assertTrue(ids.contains(new Integer(33005)));
+    }
+
     public void testIn() throws Exception {
         createInDataSet();
 
@@ -428,5 +449,5 @@ public class DataContextEJBQLConditionsT
         assertTrue(ids.contains(new Integer(33009)));
         assertTrue(ids.contains(new Integer(33010)));
     }
-
+    
 }



Mime
View raw message