Refactor to remove abstraction.
This commit is contained in:
@@ -12,6 +12,12 @@ package engine.db.handlers;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.VendorDialog;
|
import engine.objects.VendorDialog;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class dbVendorDialogHandler extends dbHandlerBase {
|
public class dbVendorDialogHandler extends dbHandlerBase {
|
||||||
|
|
||||||
@@ -21,11 +27,24 @@ public class dbVendorDialogHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public VendorDialog GET_VENDORDIALOG(final int objectUUID) {
|
public VendorDialog GET_VENDORDIALOG(final int objectUUID) {
|
||||||
VendorDialog vd = (VendorDialog) DbManager.getFromCache(Enum.GameObjectType.VendorDialog, objectUUID);
|
|
||||||
if (vd != null)
|
VendorDialog vendorDialog = (VendorDialog) DbManager.getFromCache(Enum.GameObjectType.VendorDialog, objectUUID);
|
||||||
return vd;
|
|
||||||
prepareCallable("SELECT * FROM `static_npc_vendordialog` WHERE `ID`=?");
|
if (vendorDialog != null)
|
||||||
setInt(1, objectUUID);
|
return vendorDialog;
|
||||||
return (VendorDialog) getObjectSingle(objectUUID);
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_vendordialog` WHERE `ID`=?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, objectUUID);
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
vendorDialog = (VendorDialog) getObjectFromRs(rs);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return vendorDialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user