This is an automated email from the ASF dual-hosted git repository. bchapuis pushed a commit to branch 745-daylight in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit 30dc007b54c9de8b83503a1482b47650553a53df Author: Bertil Chapuis <[email protected]> AuthorDate: Wed Sep 13 15:27:18 2023 +0200 Log queries --- .../java/org/apache/baremaps/workflow/tasks/ExecuteSql.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java index f40842bb..57947c5c 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java @@ -18,12 +18,17 @@ import java.sql.SQLException; import java.util.Arrays; import java.util.regex.Pattern; import java.util.stream.Stream; + import org.apache.baremaps.workflow.Task; import org.apache.baremaps.workflow.WorkflowContext; import org.apache.baremaps.workflow.WorkflowException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public record ExecuteSql(Object database, Path file, boolean parallel) implements Task { + private static final Logger logger = LoggerFactory.getLogger(ExecuteSql.class); + @Override public void execute(WorkflowContext context) throws Exception { var script = clean(Files.readString(file)); @@ -34,9 +39,9 @@ public record ExecuteSql(Object database, Path file, boolean parallel) implement queries.forEach( query -> { var dataSource = context.getDataSource(database); - try (var connection = dataSource.getConnection(); - var statement = connection.createStatement()) { - statement.execute(query); + try (var connection = dataSource.getConnection()) { + logger.info("Execute SQL query: {}", query); + connection.createStatement().execute(query); } catch (SQLException e) { throw new WorkflowException(e); }
