From 609ee4621e7dfc770e4fbd38de9ea3641366d24b Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 22 May 2023 05:58:30 -0400 Subject: [PATCH] Refactor to remove abstraction --- src/engine/db/handlers/dbKitHandler.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/engine/db/handlers/dbKitHandler.java b/src/engine/db/handlers/dbKitHandler.java index c0fa92ac..c1c0be74 100644 --- a/src/engine/db/handlers/dbKitHandler.java +++ b/src/engine/db/handlers/dbKitHandler.java @@ -9,8 +9,14 @@ package engine.db.handlers; +import engine.gameManager.DbManager; import engine.objects.Kit; +import org.pmw.tinylog.Logger; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; import java.util.ArrayList; public class dbKitHandler extends dbHandlerBase { @@ -21,8 +27,19 @@ public class dbKitHandler extends dbHandlerBase { } public ArrayList GET_ALL_KITS() { - prepareCallable("SELECT * FROM `static_rune_validkit`"); - return getObjectList(); + ArrayList kitList = new ArrayList<>(); + + try (Connection connection = DbManager.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_rune_validkit`")) { + + ResultSet rs = preparedStatement.executeQuery(); + kitList = getObjectsFromRs(rs, 20); + + } catch (SQLException e) { + Logger.error(e); + } + + return kitList; } }