forked from MagicBane/Server
Refactor to remove abstraction.
This commit is contained in:
@@ -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) {
|
|
||||||
prepareCallable("SELECT * FROM `static_rune_runebaseattribute` WHERE `RuneBaseID`=?");
|
|
||||||
setInt(1, id);
|
|
||||||
return getObjectList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE() {
|
public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE() {
|
||||||
prepareCallable("SELECT * FROM `static_rune_runebaseattribute`");
|
|
||||||
return getObjectList();
|
ArrayList<RuneBaseAttribute> runeBaseAttributesList = new ArrayList<>();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
return runeBaseAttributesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user