openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r814074 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java
Date Fri, 11 Sep 2009 23:15:06 GMT
Author: faywang
Date: Fri Sep 11 23:15:06 2009
New Revision: 814074

URL: http://svn.apache.org/viewvc?rev=814074&view=rev
Log:
OPENJPA-1295: fix the problem of escape character for MySQL 

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java?rev=814074&r1=814073&r2=814074&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/MatchesExpression.java
Fri Sep 11 23:15:06 2009
@@ -21,6 +21,7 @@
 import java.util.Map;
 
 import org.apache.openjpa.jdbc.schema.Column;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
 import org.apache.openjpa.kernel.exps.ExpressionVisitor;
@@ -103,8 +104,12 @@
             buf.append(" LIKE ").appendValue(str, col);
 
             // escape out characters by using the database's escape sequence
-            if (_escape != null)
+            DBDictionary dict = ctx.store.getDBDictionary();
+            if (_escape != null && _escape.equals("\\")) {
+                buf.append(" ESCAPE '").append(dict.searchStringEscape).append("'");
+            } else
                 buf.append(" ESCAPE '").append(_escape).append("'");
+            
         }
         sel.append(buf, state.joins);
     }



Mime
View raw message