Would you believe, yet another convenience method?
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1655 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -127,6 +127,15 @@ public class JDBCUtil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes any single quotes in the supplied text and wraps it in
|
||||
* single quotes to make it safe for embedding into a database query.
|
||||
*/
|
||||
public static String escape (String text)
|
||||
{
|
||||
return "'" + StringUtil.replace(text, "'", "\\'") + ",";
|
||||
}
|
||||
|
||||
/**
|
||||
* Many databases simply fail to handle Unicode text properly and this
|
||||
* routine provides a common workaround which is to represent a UTF-8
|
||||
|
||||
Reference in New Issue
Block a user