cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkazimirc...@apache.org
Subject svn commit: r1142922 - in /cayenne/main/branches/STABLE-3.0: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/exp/
Date Tue, 05 Jul 2011 08:31:09 GMT
Author: dkazimirchyk
Date: Tue Jul  5 08:31:09 2011
New Revision: 1142922

URL: http://svn.apache.org/viewvc?rev=1142922&view=rev
Log:
CAY-1577 SQL queries for LIKE expressions with escape character generated with syntax errors

patch + unit test
applied this for 3.0 branch

Modified:
    cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java

Modified: cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=1142922&r1=1142921&r2=1142922&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt Tue Jul
 5 08:31:09 2011
@@ -8,11 +8,20 @@ To browse individual bug reports check o
 http://issues.apache.org/cayenne/
 
 ----------------------------------
+Release: 3.0.3
+Date: 
+----------------------------------
+
+Bug Fixes Since 3.0.2:
+
+CAY-1577 SQL queries for LIKE expressions with escape character generated with syntax errors
+
+----------------------------------
 Release: 3.0.2
 Date: 
 ----------------------------------
 
-Improvements Sice 3.0.1
+Improvements Since 3.0.1
 
 CAY-1500 MySQL JDBC Batching
 CAY-1575 Error generating Embeddable classes in Cayenne Modeler

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java?rev=1142922&r1=1142921&r2=1142922&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
Tue Jul  5 08:31:09 2011
@@ -352,17 +352,17 @@ public class QualifierTranslator extends
             boolean isPatternMatchNode = PatternMatchNode.class.isAssignableFrom(node
                     .getClass());
 
-            if (isPatternMatchNode && !likeIgnoreCase)
-                appendLikeEscapeCharacter((PatternMatchNode) node);
-
             if (parenthesisNeeded)
                 out.append(')');
 
-            if (isPatternMatchNode && likeIgnoreCase)
+            if (isPatternMatchNode && !likeIgnoreCase)
                 appendLikeEscapeCharacter((PatternMatchNode) node);
 
             if (likeIgnoreCase)
                 out.append(')');
+
+            if (isPatternMatchNode && likeIgnoreCase)
+                appendLikeEscapeCharacter((PatternMatchNode) node);
         }
         catch (IOException ioex) {
             throw new CayenneRuntimeException("Error appending content", ioex);

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java?rev=1142922&r1=1142921&r2=1142922&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java
Tue Jul  5 08:31:09 2011
@@ -334,4 +334,24 @@ public class ExpressionFactoryTest exten
         SelectQuery query = new SelectQuery(Artist.class, ExpressionFactory.inExp("artistName",
numbers));
         createDataContext().performQuery(query);
     }
+
+    public void testEscapeCharacter() {
+        ObjectContext dc = createDataContext();
+
+        Artist a1 = dc.newObject(Artist.class);
+        a1.setArtistName("A_1");
+        Artist a2 = dc.newObject(Artist.class);
+        a2.setArtistName("A_2");
+        dc.commitChanges();
+        
+        Expression ex1 = ExpressionFactory.likeIgnoreCaseDbExp("ARTIST_NAME", "A*_1", '*');
+        SelectQuery q1 = new SelectQuery(Artist.class, ex1);
+        List<Artist> artists = dc.performQuery(q1);
+        assertEquals(1, artists.size());
+        
+        Expression ex2 = ExpressionFactory.likeExp("artistName", "A*_2", '*');
+        SelectQuery q2 = new SelectQuery(Artist.class, ex2);
+        artists = dc.performQuery(q2);
+        assertEquals(1, artists.size());
+    }
 }



Mime
View raw message