Merge pull request #3479 from dataease/pr@dev@dataset

fix(数据源): mysql8 获取表字段为空
This commit is contained in:
王嘉豪 2022-10-27 13:40:08 +08:00 committed by GitHub
commit 7cc0fa5823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,7 +90,9 @@ public class JdbcProvider extends DefaultJdbcProvider {
DatabaseMetaData databaseMetaData = connection.getMetaData();
String tableNamePattern = datasourceRequest.getTable();
if(datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.mysql.name())){
tableNamePattern = String.format(MySQLConstants.KEYWORD_TABLE, tableNamePattern);
if(databaseMetaData.getDriverMajorVersion() < 8){
tableNamePattern = String.format(MySQLConstants.KEYWORD_TABLE, tableNamePattern);
}
}
ResultSet resultSet = databaseMetaData.getColumns(null, "%", tableNamePattern, "%");
while (resultSet.next()) {