You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/09/06 03:08:33 UTC

[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #20616: add constraint info in PostgreSQLSchemaMetaDataLoader

strongduanmu commented on code in PR #20616:
URL: https://github.com/apache/shardingsphere/pull/20616#discussion_r963213382


##########
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/loader/dialect/PostgreSQLSchemaMetaDataLoader.java:
##########
@@ -107,6 +116,29 @@ private Collection<ViewMetaData> loadViewMetaData(final DataSource dataSource, f
         return result;
     }
     
+    private Map<String, Multimap<String, ConstraintMetaData>> loadConstraintMetaDataMap(final DataSource dataSource,
+                                                                                        final Collection<String> schemaNames) throws SQLException {
+        Map<String, Multimap<String, ConstraintMetaData>> result = new LinkedHashMap<>();
+        try (Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(getConstraintKeyMetaDataSQL(schemaNames))) {
+            try (ResultSet resultSet = preparedStatement.executeQuery()) {
+                while (resultSet.next()) {
+                    String schemaName = resultSet.getString("table_schema");
+                    Multimap<String, ConstraintMetaData> constraintMetaData = result.computeIfAbsent(schemaName, key -> LinkedHashMultimap.create());
+                    

Review Comment:
   Please remove useless blank line.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org