欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

mysql模糊查询匹配特殊字符

程序员文章站 2024-01-25 17:38:34
...

StringBuilder selectStatement = new StringBuilder(128).append(select).append(verbosity.getColumnSelectFragment()); StringBuilder fromStatement =new StringBuilder(128).append(from).append(tableName).append(where); fromStatement.append(COLUM

StringBuilder selectStatement = new StringBuilder(128).append("select").append(verbosity.getColumnSelectFragment());
StringBuilder fromStatement =new StringBuilder(128).append("from").append(tableName).append("where");

fromStatement.append(COLUMN.NAME.aliasAndName).append("like ? escape ?");

List params = new ArrayList();

params.add("%" + DB_ADAPTER.escapeAllWildcardsForLikeStatement(name) + "%");
params.add(DB_ADAPTER.getLikeEscapeSequence());