老用数据库,竟然忽略了,特殊字符的处理,记录下,加深下印象:
public static String sqliteEscape(String keyWord){ keyWord = keyWord.replace("/","//"); keyWord = keyWord.replace("'","''"); keyWord = keyWord.replace("[","/["); keyWord = keyWord.replace("]","/]"); keyWord = keyWord.replace("%","/%"); keyWord = keyWord.replace("&","/&"); keyWord = keyWord.replace("_","/_"); keyWord = keyWord.replace("(","/("); keyWord = keyWord.replace(")","/)"); return keyWord; }
原文链接:https://www.f2er.com/sqlite/201270.html