forked from github/dataease
Merge pull request #11716 from dataease/pr@dev-v2@fix_ds
fix(数据集): 修复SQL片段分号结尾后有空格、换行符报错的问题
This commit is contained in:
commit
c5e4fb5d7e
@ -481,8 +481,9 @@ public class SqlparserUtils {
|
||||
if (StringUtils.isEmpty(sql)) {
|
||||
DEException.throwException(Translator.get("i18n_sql_not_empty"));
|
||||
}
|
||||
if (sql.trim().endsWith(";")) {
|
||||
sql = sql.trim().substring(0, sql.length() - 1);
|
||||
sql = sql.trim();
|
||||
if (sql.endsWith(";")) {
|
||||
sql = sql.substring(0, sql.length() - 1);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(sqlVariableDetails)) {
|
||||
|
@ -450,8 +450,9 @@ public class CopilotManage {
|
||||
public String transSql(String type, String copilotSQL, Provider provider, ReceiveDTO receiveDTO) {
|
||||
if (type.equals("oracle") || type.equals("sqlServer")) {
|
||||
try {
|
||||
if (copilotSQL.trim().endsWith(";")) {
|
||||
copilotSQL = copilotSQL.trim().substring(0, copilotSQL.length() - 1);
|
||||
copilotSQL = copilotSQL.trim();
|
||||
if (copilotSQL.endsWith(";")) {
|
||||
copilotSQL = copilotSQL.substring(0, copilotSQL.length() - 1);
|
||||
}
|
||||
DatasourceSchemaDTO datasourceSchemaDTO = new DatasourceSchemaDTO();
|
||||
datasourceSchemaDTO.setType(type);
|
||||
|
@ -20,8 +20,9 @@ public class SqlUtils {
|
||||
public static Logger logger = LoggerFactory.getLogger(SqlUtils.class);
|
||||
|
||||
public static String addSchema(String sql, String schema) {
|
||||
if (sql.trim().endsWith(";")) {
|
||||
sql = sql.trim().substring(0, sql.length() - 1);
|
||||
sql = sql.trim();
|
||||
if (sql.endsWith(";")) {
|
||||
sql = sql.substring(0, sql.length() - 1);
|
||||
}
|
||||
|
||||
SqlParser.Config config =
|
||||
|
Loading…
Reference in New Issue
Block a user