fix: 【数据源】上传excel提示异常,给出提示: 文本内容超出最大支持范围

This commit is contained in:
taojinlong 2024-11-06 11:40:50 +08:00
parent c60c89a9d9
commit e4a978e3c7
2 changed files with 7 additions and 3 deletions

View File

@ -89,7 +89,7 @@ public class MysqlEngineProvider extends EngineProvider {
int size = tableField.getPrecision() * 4;
switch (tableField.getDeExtractType()) {
case 0:
Column_Fields.append("varchar(2048)").append(",`");
Column_Fields.append("varchar(1024)").append(",`");
break;
case 1:
Column_Fields.append("datetime").append(",`");
@ -104,7 +104,7 @@ public class MysqlEngineProvider extends EngineProvider {
Column_Fields.append("TINYINT(length)".replace("length", String.valueOf(tableField.getPrecision()))).append(",`");
break;
default:
Column_Fields.append("varchar(2048)").append(",`");
Column_Fields.append("varchar(1024)").append(",`");
break;
}
}

View File

@ -267,7 +267,11 @@ public class DatasourceServer implements DatasourceApi {
try {
datasourceSyncManage.createEngineTable(datasourceRequest.getTable(), tableFields);
} catch (Exception e) {
DEException.throwException("Failed to create table " + datasourceRequest.getTable() + ", " + e.getMessage());
if (e.getMessage().toLowerCase().contains("Row size too large".toLowerCase())) {
DEException.throwException("文本内容超出最大支持范围: " + datasourceRequest.getTable() + ", " + e.getMessage());
} else {
DEException.throwException("Failed to create table " + datasourceRequest.getTable() + ", " + e.getMessage());
}
}
}
commonThreadPool.addTask(() -> {