You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "gong (via GitHub)" <gi...@apache.org> on 2023/03/08 13:06:21 UTC

[GitHub] [inlong] gong commented on a diff in pull request #7549: [INLONG-7548][Agent][Manager] Use try-with-resource to close resources

gong commented on code in PR #7549:
URL: https://github.com/apache/inlong/pull/7549#discussion_r1129400873


##########
inlong-sort/sort-connectors/jdbc/src/main/java/org/apache/inlong/sort/jdbc/dialect/MySQLDialect.java:
##########
@@ -156,9 +156,10 @@ public List<LogicalTypeRoot> unsupportedTypes() {
 
     @Override
     public PreparedStatement setQueryPrimaryKeySql(Connection conn, String tableIdentifier) throws SQLException {
-        PreparedStatement st = conn.prepareStatement(QUERY_PRIMARY_KEY_SQL);
-        st.setString(1, JdbcMultiBatchingComm.getDatabaseNameFromIdentifier(tableIdentifier));
-        st.setString(2, JdbcMultiBatchingComm.getTableNameFromIdentifier(tableIdentifier));
-        return st;
+        try (PreparedStatement st = conn.prepareStatement(QUERY_PRIMARY_KEY_SQL)) {

Review Comment:
   I don't think here need to use try. AbstractJdbcDialect will close it.



-- 
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: commits-unsubscribe@inlong.apache.org

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