refactor: 优化一下

This commit is contained in:
taojinlong 2021-10-21 15:30:04 +08:00
parent 7f3f550304
commit 8e50280de8

View File

@ -204,13 +204,16 @@ public class JdbcProvider extends DatasourceProvider {
}
String queryView = getViewSql(datasourceRequest);
try (Connection con = getConnectionFromPool(datasourceRequest); Statement statement = con.createStatement(); ResultSet resultSet = statement.executeQuery(queryView)){
while (resultSet.next()) {
tables.add(resultSet.getString(1));
if(queryView != null){
try (Connection con = getConnectionFromPool(datasourceRequest); Statement statement = con.createStatement(); ResultSet resultSet = statement.executeQuery(queryView)){
while (resultSet.next()) {
tables.add(resultSet.getString(1));
}
} catch (Exception e) {
DataEaseException.throwException(e);
}
} catch (Exception e) {
DataEaseException.throwException(e);
}
return tables;
}