From 5743472f9dfa8ad5e27ed9139ad23e8697b9717b Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Mon, 17 Jul 2023 15:31:39 +0800 Subject: [PATCH] Fix deprecated jOOQ usage --- src/main/java/com/thoughtworks/go/dbsync/DbSync.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/thoughtworks/go/dbsync/DbSync.java b/src/main/java/com/thoughtworks/go/dbsync/DbSync.java index 4418b6f..4ffb4a1 100644 --- a/src/main/java/com/thoughtworks/go/dbsync/DbSync.java +++ b/src/main/java/com/thoughtworks/go/dbsync/DbSync.java @@ -29,7 +29,7 @@ import org.apache.commons.io.FileUtils; import org.jooq.Record; import org.jooq.*; -import org.jooq.conf.RenderNameStyle; +import org.jooq.conf.RenderNameCase; import org.jooq.conf.SettingsTools; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,8 +48,8 @@ import static com.thoughtworks.go.dbsync.Util.comment; import static com.thoughtworks.go.dbsync.Util.*; -import static org.jooq.conf.RenderNameStyle.AS_IS; -import static org.jooq.conf.RenderNameStyle.QUOTED; +import static org.jooq.conf.RenderQuotedNames.EXPLICIT_DEFAULT_QUOTED; +import static org.jooq.conf.RenderQuotedNames.NEVER; import static org.jooq.impl.DSL.*; import static org.jooq.tools.StringUtils.isBlank; @@ -373,6 +373,7 @@ private void executAndLogInsertStatement(String table, DataSource targetDataSour InsertValuesStepN insertQuery = insertInto(table(table), fields); for (Record record : records) { + //noinspection ResultOfMethodCallIgnored insertQuery.values(record.intoArray()); } @@ -384,10 +385,11 @@ private void executAndLogInsertStatement(String table, DataSource targetDataSour private static DSLContext renderer(Connection targetConnection) { Configuration targetConfiguration = using(targetConnection).configuration(); - RenderNameStyle renderNameStyle = targetConfiguration.dialect().family() == SQLDialect.POSTGRES ? AS_IS : QUOTED; return using(targetConfiguration.derive(SettingsTools.clone(targetConfiguration.settings()) .withRenderFormatted(false) - .withRenderNameStyle(renderNameStyle))); + .withRenderNameCase(RenderNameCase.AS_IS) + .withRenderQuotedNames(targetConfiguration.dialect().family() != SQLDialect.POSTGRES ? EXPLICIT_DEFAULT_QUOTED : NEVER) + )); } @SuppressWarnings("resource")