From ee585e8e5f511680d556f329119bf3b3c0ad66eb Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 10 May 2024 17:10:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=B0=E6=8D=AE=E9=9B=86):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DSQL=E7=89=87=E6=AE=B5=E4=B8=AD=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/dataease/dataset/utils/SqlUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/dataset/utils/SqlUtils.java b/core/core-backend/src/main/java/io/dataease/dataset/utils/SqlUtils.java index c4e4179a90..aecc0508bb 100644 --- a/core/core-backend/src/main/java/io/dataease/dataset/utils/SqlUtils.java +++ b/core/core-backend/src/main/java/io/dataease/dataset/utils/SqlUtils.java @@ -16,6 +16,7 @@ import org.apache.commons.collections4.MapUtils; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.regex.Matcher; import static org.apache.calcite.sql.SqlKind.*; @@ -143,7 +144,7 @@ public class SqlUtils { public static String replaceTablePlaceHolder(String s, String placeholder) { s = s.replaceAll("\r\n", " ") .replaceAll("\n", " ") - .replaceAll(SqlPlaceholderConstants.TABLE_PLACEHOLDER_REGEX, placeholder) + .replaceAll(SqlPlaceholderConstants.TABLE_PLACEHOLDER_REGEX, Matcher.quoteReplacement(placeholder)) .replaceAll("ASYMMETRIC", "") .replaceAll("SYMMETRIC", ""); return s; @@ -169,7 +170,7 @@ public class SqlUtils { if (MapUtils.isNotEmpty(fieldsDialect)) { for (Map.Entry ele : fieldsDialect.entrySet()) { - s = s.replaceAll(SqlPlaceholderConstants.KEYWORD_PREFIX_REGEX + ele.getKey() + SqlPlaceholderConstants.KEYWORD_SUFFIX_REGEX, ele.getValue()); + s = s.replaceAll(SqlPlaceholderConstants.KEYWORD_PREFIX_REGEX + ele.getKey() + SqlPlaceholderConstants.KEYWORD_SUFFIX_REGEX, Matcher.quoteReplacement(ele.getValue())); } } return s;