Browse Source

Refactor to remove abstraction.

master
MagicBot 2 years ago
parent
commit
3a95cc9b58
  1. 26
      src/engine/db/handlers/dbRuneBaseAttributeHandler.java

26
src/engine/db/handlers/dbRuneBaseAttributeHandler.java

@ -9,8 +9,14 @@
package engine.db.handlers; package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.objects.RuneBaseAttribute; import engine.objects.RuneBaseAttribute;
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; import java.util.ArrayList;
public class dbRuneBaseAttributeHandler extends dbHandlerBase { public class dbRuneBaseAttributeHandler extends dbHandlerBase {
@ -20,15 +26,21 @@ public class dbRuneBaseAttributeHandler extends dbHandlerBase {
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName()); this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
} }
public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE(int id) { public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE() {
prepareCallable("SELECT * FROM `static_rune_runebaseattribute` WHERE `RuneBaseID`=?");
setInt(1, id); ArrayList<RuneBaseAttribute> runeBaseAttributesList = new ArrayList<>();
return getObjectList();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_rune_runebaseattribute`")) {
ResultSet rs = preparedStatement.executeQuery();
runeBaseAttributesList = getObjectsFromRs(rs, 10);
} catch (SQLException e) {
Logger.error(e);
} }
public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE() { return runeBaseAttributesList;
prepareCallable("SELECT * FROM `static_rune_runebaseattribute`");
return getObjectList();
} }

Loading…
Cancel
Save