vran
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
6 deletions
-
plugin/src/main/java/com/databasir/core/meta/repository/impl/jdbc/JdbcColumnMetaRepository.java
-
plugin/src/main/java/com/databasir/core/meta/repository/impl/jdbc/JdbcForeignKeyMetaRepository.java
|
@ -94,11 +94,15 @@ public class JdbcColumnMetaRepository implements ColumnMetaRepository { |
|
|
TableCondition tableCondition) throws SQLException { |
|
|
TableCondition tableCondition) throws SQLException { |
|
|
ResultSet result = meta.getPrimaryKeys(tableCondition.getDatabaseName(), |
|
|
ResultSet result = meta.getPrimaryKeys(tableCondition.getDatabaseName(), |
|
|
tableCondition.getSchemaName(), tableCondition.getTableName()); |
|
|
tableCondition.getSchemaName(), tableCondition.getTableName()); |
|
|
|
|
|
try { |
|
|
List<String> columns = new ArrayList<>(); |
|
|
List<String> columns = new ArrayList<>(); |
|
|
while (result.next()) { |
|
|
while (result.next()) { |
|
|
String columnName = result.getString("COLUMN_NAME"); |
|
|
String columnName = result.getString("COLUMN_NAME"); |
|
|
columns.add(columnName); |
|
|
columns.add(columnName); |
|
|
} |
|
|
} |
|
|
return columns; |
|
|
return columns; |
|
|
|
|
|
} finally { |
|
|
|
|
|
result.close(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
@ -52,7 +52,9 @@ public class JdbcForeignKeyMetaRepository implements ForeignKeyMetaRepository { |
|
|
log.warn("warn: ignore foreign keys in " + databaseName + "." + tableName + ", " + e.getMessage()); |
|
|
log.warn("warn: ignore foreign keys in " + databaseName + "." + tableName + ", " + e.getMessage()); |
|
|
} finally { |
|
|
} finally { |
|
|
try { |
|
|
try { |
|
|
|
|
|
if (keyResult != null) { |
|
|
keyResult.close(); |
|
|
keyResult.close(); |
|
|
|
|
|
} |
|
|
} catch (SQLException e) { |
|
|
} catch (SQLException e) { |
|
|
log.warn("warn: close key result error " + databaseName + "." + tableName + ", " + e.getMessage()); |
|
|
log.warn("warn: close key result error " + databaseName + "." + tableName + ", " + e.getMessage()); |
|
|
} |
|
|
} |
|
|