mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
fix(数据集): 修复SQL误判断注释的错误 #13403
This commit is contained in:
parent
9ee7d49db2
commit
1228a15d96
@ -8,6 +8,7 @@ import io.dataease.extensions.datasource.dto.*;
|
||||
import io.dataease.extensions.datasource.model.SQLMeta;
|
||||
import io.dataease.extensions.datasource.vo.DatasourceConfiguration;
|
||||
import lombok.Getter;
|
||||
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
|
||||
import org.apache.calcite.config.Lex;
|
||||
import org.apache.calcite.sql.SqlDialect;
|
||||
import org.apache.calcite.sql.SqlNode;
|
||||
@ -196,8 +197,13 @@ public abstract class Provider {
|
||||
}
|
||||
|
||||
public String replaceComment(String s) {
|
||||
String regex = "/\\*[\\s\\S]*?\\*/|-- .*";
|
||||
return s.replaceAll(regex, " ");
|
||||
try {
|
||||
net.sf.jsqlparser.statement.Statement parse = CCJSqlParserUtil.parse(s);
|
||||
return parse.toString();
|
||||
} catch (Exception e) {
|
||||
DEException.throwException("SQL ERROR");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SqlDialect getDialect(DatasourceSchemaDTO coreDatasource) {
|
||||
|
Loading…
Reference in New Issue
Block a user