Removing escapeSql per LANG-493

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@786942 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2009-06-21 05:35:04 +00:00
parent 1645f246d3
commit bc1104da49
2 changed files with 0 additions and 37 deletions

View File

@ -665,32 +665,6 @@ public class StringEscapeUtils {
return Entities.XML.unescape(str);
}
//-----------------------------------------------------------------------
/**
* <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, "'", "''");
}
//-----------------------------------------------------------------------
/**

View File

@ -324,17 +324,6 @@ public class StringEscapeUtilsTest extends TestCase {
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() {