forked from github/dataease
Merge pull request #3479 from dataease/pr@dev@dataset
fix(数据源): mysql8 获取表字段为空
This commit is contained in:
commit
7cc0fa5823
@ -90,8 +90,10 @@ public class JdbcProvider extends DefaultJdbcProvider {
|
|||||||
DatabaseMetaData databaseMetaData = connection.getMetaData();
|
DatabaseMetaData databaseMetaData = connection.getMetaData();
|
||||||
String tableNamePattern = datasourceRequest.getTable();
|
String tableNamePattern = datasourceRequest.getTable();
|
||||||
if(datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.mysql.name())){
|
if(datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.mysql.name())){
|
||||||
|
if(databaseMetaData.getDriverMajorVersion() < 8){
|
||||||
tableNamePattern = String.format(MySQLConstants.KEYWORD_TABLE, tableNamePattern);
|
tableNamePattern = String.format(MySQLConstants.KEYWORD_TABLE, tableNamePattern);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ResultSet resultSet = databaseMetaData.getColumns(null, "%", tableNamePattern, "%");
|
ResultSet resultSet = databaseMetaData.getColumns(null, "%", tableNamePattern, "%");
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
String tableName = resultSet.getString("TABLE_NAME");
|
String tableName = resultSet.getString("TABLE_NAME");
|
||||||
|
Loading…
Reference in New Issue
Block a user