commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r786942 - in /commons/proper/lang/trunk/src: java/org/apache/commons/lang/StringEscapeUtils.java test/org/apache/commons/lang/StringEscapeUtilsTest.java
Date Sun, 21 Jun 2009 05:35:05 GMT
Author: bayard
Date: Sun Jun 21 05:35:04 2009
New Revision: 786942

URL: http://svn.apache.org/viewvc?rev=786942&view=rev
Log:
Removing escapeSql per LANG-493

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
    commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java?rev=786942&r1=786941&r2=786942&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java Sun
Jun 21 05:35:04 2009
@@ -666,32 +666,6 @@
     }
 
     //-----------------------------------------------------------------------
-    /**
-     * <p>Escapes the characters in a <code>String</code> to be suitable
to pass to
-     * an SQL query.</p>
-     *
-     * <p>For example,
-     * <pre>statement.executeQuery("SELECT * FROM MOVIES WHERE TITLE='" + 
-     *   StringEscapeUtils.escapeSql("McHale's Navy") + 
-     *   "'");</pre>
-     * </p>
-     *
-     * <p>At present, this method only turns single-quotes into doubled single-quotes
-     * (<code>"McHale's Navy"</code> => <code>"McHale''s Navy"</code>).
It does not
-     * handle the cases of percent (%) or underscore (_) for use in LIKE clauses.</p>
-     *
-     * see http://www.jguru.com/faq/view.jsp?EID=8881
-     * @param str  the string to escape, may be null
-     * @return a new String, escaped for SQL, <code>null</code> if null string
input
-     */
-    public static String escapeSql(String str) {
-        if (str == null) {
-            return null;
-        }
-        return StringUtils.replace(str, "'", "''");
-    }
-
-    //-----------------------------------------------------------------------
 
     /**
      * <p>Returns a <code>String</code> value for a CSV column enclosed
in double quotes,

Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java?rev=786942&r1=786941&r2=786942&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java
Sun Jun 21 05:35:04 2009
@@ -324,17 +324,6 @@
         assertEquals("XML was unescaped incorrectly", "<abc>", sw.toString() );
     }
 
-    // SQL
-    // see http://www.jguru.com/faq/view.jsp?EID=8881
-    //--------------------
-
-    public void testEscapeSql() throws Exception
-    {
-        assertEquals("don''t stop", StringEscapeUtils.escapeSql("don't stop"));
-        assertEquals("", StringEscapeUtils.escapeSql(""));
-        assertEquals(null, StringEscapeUtils.escapeSql(null));
-    }
-
     // Tests issue #38569
     // http://issues.apache.org/bugzilla/show_bug.cgi?id=38569
     public void testStandaloneAmphersand() {



Mime
View raw message