Skip to content

JDBC: Static SQL #1824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class DatasourceOperations {
private static final String SERIALIZATION_FAILURE_SQL_CODE = "40001";

private final DataSource datasource;
private final RelationalJdbcConfiguration relationalJdbcConfiguration;
private final DatabaseType databaseType;
private final RelationalJdbcConfiguration relationalJdbcConfiguration;
Comment on lines -57 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: spurious change?


private final Random random = new Random();

Expand Down Expand Up @@ -126,8 +126,7 @@ public void executeScript(String scriptFilePath) throws SQLException {
* @throws SQLException : Exception during the query execution.
*/
public <T> List<T> executeSelect(
@Nonnull QueryGenerator.PreparedQuery query, @Nonnull Converter<T> converterInstance)
throws SQLException {
@Nonnull PreparedQuery query, @Nonnull Converter<T> converterInstance) throws SQLException {
ArrayList<T> results = new ArrayList<>();
executeSelectOverStream(query, converterInstance, stream -> stream.forEach(results::add));
return results;
Expand All @@ -144,7 +143,7 @@ public <T> List<T> executeSelect(
* @throws SQLException : Exception during the query execution.
*/
public <T> void executeSelectOverStream(
@Nonnull QueryGenerator.PreparedQuery query,
@Nonnull PreparedQuery query,
@Nonnull Converter<T> converterInstance,
@Nonnull Consumer<Stream<T>> consumer)
throws SQLException {
Expand Down Expand Up @@ -172,7 +171,7 @@ public <T> void executeSelectOverStream(
* @return : Number of rows modified / inserted.
* @throws SQLException : Exception during Query Execution.
*/
public int executeUpdate(QueryGenerator.PreparedQuery preparedQuery) throws SQLException {
public int executeUpdate(PreparedQuery preparedQuery) throws SQLException {
return withRetries(
() -> {
try (Connection connection = borrowConnection();
Expand Down Expand Up @@ -223,8 +222,7 @@ public void runWithinTransaction(TransactionCallback callback) throws SQLExcepti
});
}

public Integer execute(Connection connection, QueryGenerator.PreparedQuery preparedQuery)
throws SQLException {
public Integer execute(Connection connection, PreparedQuery preparedQuery) throws SQLException {
try (PreparedStatement statement = connection.prepareStatement(preparedQuery.sql())) {
List<Object> params = preparedQuery.parameters();
for (int i = 0; i < params.size(); i++) {
Expand Down
Loading
Loading