dimas-b commented on code in PR #3334:
URL: https://github.com/apache/polaris/pull/3334#discussion_r2653266620
##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/DatasourceOperations.java:
##########
@@ -142,6 +142,56 @@ public <T> List<T> executeSelect(
return results;
}
+ /**
+ * Executes SELECT Query using an existing connection (for use within
transactions). Returns the
+ * results after applying a transformer.
+ *
+ * @param query : Query to execute
+ * @param converterInstance : An instance of the type being selected, used
to convert to a
+ * business entity like PolarisBaseEntity
+ * @param connection : The connection to use for the query
+ * @return The list of results yielded by the query
+ * @param <T> : Business entity class
+ * @throws SQLException : Exception during the query execution.
+ */
+ public <T> List<T> executeSelect(
+ @Nonnull QueryGenerator.PreparedQuery query,
+ @Nonnull Converter<T> converterInstance,
+ @Nonnull Connection connection)
+ throws SQLException {
+ logQuery(query);
+ return executeSelectWithConnection(query, converterInstance, connection);
+ }
+
+ /**
+ * Helper method to execute a SELECT query with a given connection and
collect results.
+ *
+ * @param query : Query to execute
+ * @param converterInstance : Converter to transform ResultSet rows
+ * @param connection : Connection to use (must not be closed by this method)
+ * @return List of converted results
+ * @param <T> : Business entity class
+ * @throws SQLException : Exception during query execution
+ */
+ private <T> List<T> executeSelectWithConnection(
Review Comment:
nit: this method is called from only one place... why not inline?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]