Browse Source

feat: add compatible when get databasemeta (#110)

master
vran 3 years ago
committed by GitHub
parent
commit
b33cab86d9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      plugin/src/main/java/com/databasir/core/meta/repository/impl/jdbc/JdbcDatabaseMetaRepository.java

16
plugin/src/main/java/com/databasir/core/meta/repository/impl/jdbc/JdbcDatabaseMetaRepository.java

@ -39,6 +39,22 @@ public class JdbcDatabaseMetaRepository implements DatabaseMetaRepository {
return Optional.of(meta); return Optional.of(meta);
} }
} }
ResultSet schemas = metaData.getSchemas();
while (schemas.next()) {
String schemaName = schemas.getString("TABLE_SCHEM");
if (Objects.equals(condition.getSchemaName(), schemaName)) {
List<TableMeta> tableDocs = tableMetaRepository.selectTables(connection, condition);
DatabaseMeta meta = DatabaseMeta.builder()
.productName(metaData.getDatabaseProductName())
.productVersion(metaData.getDatabaseProductVersion())
.databaseName(condition.getDatabaseName())
.schemaName(condition.getSchemaName())
.tables(tableDocs)
.build();
return Optional.of(meta);
}
}
return Optional.empty(); return Optional.empty();
} catch (SQLException e) { } catch (SQLException e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);

Loading…
Cancel
Save