From cd7a4d17d5e732e96de8682ef040fdd05cdb979a Mon Sep 17 00:00:00 2001 From: Snabeldier <79211348+Snabeldier@users.noreply.github.com> Date: Thu, 2 Jan 2025 02:26:46 +0100 Subject: [PATCH] add retrieveGeneratedKeys option --- src/main/java/minevalley/core/api/Core.java | 7 ++++++- src/main/java/minevalley/core/api/CoreServer.java | 2 +- .../minevalley/core/api/database/StatementBuilder.java | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/minevalley/core/api/Core.java b/src/main/java/minevalley/core/api/Core.java index 941ec72f..a1fe29da 100644 --- a/src/main/java/minevalley/core/api/Core.java +++ b/src/main/java/minevalley/core/api/Core.java @@ -178,7 +178,12 @@ public static BukkitTask runAsyncTaskPeriodically(long delay, long period, @Nonn @Nonnull public static StatementBuilder prepareSQL(@Nonnull @Language("SQL") String sql) { - return server.prepareSQL(sql); + return server.prepareSQL(sql, false); + } + + @Nonnull + public static StatementBuilder prepareSQL(@Nonnull @Language("SQL") String sql, boolean retrieveGeneratedKeys) { + return server.prepareSQL(sql, retrieveGeneratedKeys); } /** diff --git a/src/main/java/minevalley/core/api/CoreServer.java b/src/main/java/minevalley/core/api/CoreServer.java index 51ce38e9..96468f78 100644 --- a/src/main/java/minevalley/core/api/CoreServer.java +++ b/src/main/java/minevalley/core/api/CoreServer.java @@ -83,7 +83,7 @@ public interface CoreServer { BukkitTask runAsyncTaskPeriodically(long delay, long period, @Nonnull Runnable runnable) throws IllegalArgumentException; @Nonnull - StatementBuilder prepareSQL(@Nonnull @Language("SQL") String sql); + StatementBuilder prepareSQL(@Nonnull @Language("SQL") String sql, boolean retrieveGeneratedKeys); void registerListener(@Nonnull Class cls, @Nonnull EventListener listener) throws IllegalArgumentException; diff --git a/src/main/java/minevalley/core/api/database/StatementBuilder.java b/src/main/java/minevalley/core/api/database/StatementBuilder.java index 6eaac5fd..01fbffa5 100644 --- a/src/main/java/minevalley/core/api/database/StatementBuilder.java +++ b/src/main/java/minevalley/core/api/database/StatementBuilder.java @@ -8,7 +8,7 @@ import java.sql.*; import java.util.concurrent.CompletableFuture; -/** + /** * This interface covers some but not nearly all features of the {@link PreparedStatement} interface as provided by the JDBC API. * It's designed to provide some improvements such as an asynchronous execution and a builder pattern for setting parameters to reduce boilerplate code. * Such as the {@link PreparedStatement} interface, the results of the query can be retrieved using the {@link ResultSet} interface.