You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "dhruva1995 (via GitHub)" <gi...@apache.org> on 2023/05/08 20:48:05 UTC
[GitHub] [flink-connector-jdbc] dhruva1995 commented on a diff in pull request #4: [FLINK-29750][Connector/JDBC] Improve PostgresCatalog#listTables() by reusing resources
dhruva1995 commented on code in PR #4:
URL: https://github.com/apache/flink-connector-jdbc/pull/4#discussion_r1187884474
##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/AbstractJdbcCatalog.java:
##########
@@ -522,6 +509,25 @@ protected List<String> extractColumnValuesBySQL(
}
}
+ protected static List<String> extractColumnValuesByStatement(
+ PreparedStatement ps, int columnIndex, Predicate<String> filterFunc, Object... params)
+ throws SQLException {
+ List<String> columnValues = Lists.newArrayList();
+ if (Objects.nonNull(params) && params.length > 0) {
+ for (int i = 0; i < params.length; i++) {
+ ps.setObject(i + 1, params[i]);
+ }
+ }
+ ResultSet rs = ps.executeQuery();
Review Comment:
Nit Pick: though not related to your change but can you wrap the above line in try with resource block I think ResultSet also implements AutoClosable
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org