mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
(fix)(headless-server)sqlExecuteReq.getSql() 兼容sql前后有换行符CASE,导致sql语句结尾";"无法被正确删除 (#2327)
This commit is contained in:
@@ -23,9 +23,11 @@ public class SqlExecuteReq {
|
||||
private Integer limit = 1000;
|
||||
|
||||
public String getSql() {
|
||||
if (StringUtils.isNotBlank(sql) && sql.endsWith(";")) {
|
||||
sql = sql.substring(0, sql.length() - 1);
|
||||
if(StringUtils.isNotBlank(sql)){
|
||||
sql=sql.replaceAll("^[\\n]+|[\\n]+$", "");
|
||||
sql=StringUtils.removeEnd(sql,";");
|
||||
}
|
||||
|
||||
return String.format(LIMIT_WRAPPER, sql, limit);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user