From 244b07a3cf367e90cf4627ae7e4446f66a32c063 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Thu, 26 Oct 2023 16:04:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E9=99=90=E5=88=B6=20mysql=20?= =?UTF-8?q?=E9=9D=9E=E6=B3=95=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/dataease/datasource/type/Mysql.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/datasource/type/Mysql.java b/core/core-backend/src/main/java/io/dataease/datasource/type/Mysql.java index bdf9392570..aa4290a444 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/type/Mysql.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/type/Mysql.java @@ -13,7 +13,7 @@ import java.util.List; public class Mysql extends DatasourceConfiguration { private String driver = "com.mysql.cj.jdbc.Driver"; private String extraParams = "characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull"; - private List illegalParameters = Arrays.asList("autoDeserialize", "queryInterceptors", "statementInterceptors", "detectCustomCollations"); + private List illegalParameters = Arrays.asList("autoDeserialize", "queryInterceptors", "statementInterceptors", "detectCustomCollations", "allowloadlocalinfile", "allowUrlInLocalInfile", "allowLoadLocalInfileInPath"); private List showTableSqls = Arrays.asList("show tables"); public String getJdbc() { @@ -24,7 +24,7 @@ public class Mysql extends DatasourceConfiguration { .replace("DATABASE", getDataBase().trim()); } else { for (String illegalParameter : illegalParameters) { - if (getExtraParams().contains(illegalParameter)) { + if (getExtraParams().toLowerCase().contains(illegalParameter.toLowerCase())) { throw new RuntimeException("Illegal parameter: " + illegalParameter); } } From 29d5ceb7f4039e9491fc3d3d3912f5585d29ae9f Mon Sep 17 00:00:00 2001 From: taojinlong Date: Thu, 26 Oct 2023 16:34:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E4=B8=8A=E4=BC=A0Excel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/datasource/server/DatasourceServer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java index d34c246923..d6ffb52a20 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java @@ -265,7 +265,9 @@ public class DatasourceServer implements DatasourceApi { DEException.throwException("Failed to create table " + datasourceRequest.getTable()); } } - datasourceSyncManage.extractExcelData(coreDatasource, "all_scope"); + commonThreadPool.addTask(() -> { + datasourceSyncManage.extractExcelData(coreDatasource, "all_scope"); + }); } else if (dataSourceDTO.getType().equals(DatasourceConfiguration.DatasourceType.API.name())) { CoreDatasourceTask coreDatasourceTask = new CoreDatasourceTask(); BeanUtils.copyBean(coreDatasourceTask, dataSourceDTO.getSyncSetting()); From 8a6c10242092704c85bfd9a9f50991a46beec6ab Mon Sep 17 00:00:00 2001 From: taojinlong Date: Thu, 26 Oct 2023 16:58:32 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E6=A0=A1=E9=AA=8C=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=B1=A0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/server/DatasourceServer.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java index d6ffb52a20..b66e6e2ae8 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java @@ -34,6 +34,7 @@ import io.dataease.datasource.provider.ApiUtils; import io.dataease.datasource.provider.CalciteProvider; import io.dataease.datasource.provider.ExcelUtils; import io.dataease.datasource.request.DatasourceRequest; +import io.dataease.datasource.type.Pg; import io.dataease.engine.constant.SQLConstants; import io.dataease.exception.DEException; import io.dataease.i18n.Translator; @@ -300,11 +301,28 @@ public class DatasourceServer implements DatasourceApi { } } } else { + checkParams(dataSourceDTO.getConfiguration()); calciteProvider.update(dataSourceDTO); } return dataSourceDTO; } + private static void checkParams(String configurationStr) { + DatasourceConfiguration configuration = JsonUtil.parseObject(configurationStr, DatasourceConfiguration.class); + if(configuration.getInitialPoolSize() < configuration.getMinPoolSize()){ + DEException.throwException("初始连接数不能小于最小连接数!"); + } + if(configuration.getInitialPoolSize() > configuration.getMaxPoolSize()){ + DEException.throwException("初始连接数不能大于最大连接数!"); + } + if(configuration.getMaxPoolSize() < configuration.getMinPoolSize()){ + DEException.throwException("最大连接数不能小于最小连接数!"); + } + if(configuration.getQueryTimeout() < 0){ + DEException.throwException("查询超时不能小于0!"); + } + } + private static void checkName(List tables) { for (int i = 0; i < tables.size() - 1; i++) { for (int j = i + 1; j < tables.size(); j++) { @@ -421,6 +439,7 @@ public class DatasourceServer implements DatasourceApi { dataSourceManage.innerEdit(requestDatasource); } } else { + checkParams(dataSourceDTO.getConfiguration()); dataSourceManage.innerEdit(requestDatasource); calciteProvider.update(dataSourceDTO); }