openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtyle...@apache.org
Subject svn commit: r1180585 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
Date Sun, 09 Oct 2011 11:11:59 GMT
Author: mtylenda
Date: Sun Oct  9 11:11:58 2011
New Revision: 1180585

URL: http://svn.apache.org/viewvc?rev=1180585&view=rev
Log:
OPENJPA-2056: Use single backslash in searchStringEscape on PostgreSQL 9.1 and later.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java?rev=1180585&r1=1180584&r2=1180585&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
Sun Oct  9 11:11:58 2011
@@ -149,9 +149,6 @@ public class PostgresDictionary
         supportsSelectStartIndex = true;
         supportsSelectEndIndex = true;
 
-        // PostgreSQL requires double-escape for strings
-        searchStringEscape = "\\\\";
-
         maxTableNameLength = 63;
         maxColumnNameLength = 63;
         maxIndexNameLength = 63;
@@ -740,7 +737,7 @@ public class PostgresDictionary
     }
 
     /**
-     * Determine whether XML column is supported.
+     * Determine XML column support and backslash handling.
      */
     public void connectedConfiguration(Connection conn) throws SQLException {
         super.connectedConfiguration(conn);
@@ -768,6 +765,10 @@ public class PostgresDictionary
         if ((maj >= 9 || (maj == 8 && min >= 3))) {
             supportsXMLColumn = true;
         }
+        // Old PostgreSQL requires double-escape for strings.
+        if ((maj <= 8 || (maj == 9 && min == 0))) {
+            searchStringEscape = "\\\\";
+        }
     }
  
     /**



Mime
View raw message