Browse Source

Parm removed from stored procedure.

combat-2
MagicBot 8 months ago
parent
commit
594509e0ad
  1. 25
      src/engine/db/handlers/dbItemHandler.java

25
src/engine/db/handlers/dbItemHandler.java

@ -59,41 +59,40 @@ public class dbItemHandler extends dbHandlerBase { @@ -59,41 +59,40 @@ public class dbItemHandler extends dbHandlerBase {
public Item PERSIST(Item toAdd) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?);")) {
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?);")) {
preparedStatement.setInt(1, toAdd.ownerID);
preparedStatement.setInt(2, toAdd.getTemplateID());
preparedStatement.setInt(3, (byte) toAdd.chargesRemaining);
preparedStatement.setInt(4, (short) toAdd.combat_health_current);
preparedStatement.setInt(5, (int) toAdd.template.combat_health_full);
if (toAdd.getNumOfItems() < 1)
preparedStatement.setInt(6, 1);
preparedStatement.setInt(5, 1);
else
preparedStatement.setInt(6, toAdd.getNumOfItems());
preparedStatement.setInt(5, toAdd.getNumOfItems());
switch (toAdd.containerType) {
case INVENTORY:
preparedStatement.setString(7, "inventory");
preparedStatement.setString(6, "inventory");
break;
case EQUIPPED:
preparedStatement.setString(7, "equip");
preparedStatement.setString(6, "equip");
break;
case BANK:
preparedStatement.setString(7, "bank");
preparedStatement.setString(6, "bank");
break;
case VAULT:
preparedStatement.setString(7, "vault");
preparedStatement.setString(6, "vault");
break;
case FORGE:
preparedStatement.setString(7, "forge");
preparedStatement.setString(6, "forge");
break;
default:
preparedStatement.setString(7, "none"); //Shouldn't be here
preparedStatement.setString(6, "none"); //Shouldn't be here
break;
}
preparedStatement.setByte(8, (byte) toAdd.equipSlot.ordinal());
preparedStatement.setByte(7, (byte) toAdd.equipSlot.ordinal());
String flagString = "";
@ -102,8 +101,8 @@ public class dbItemHandler extends dbHandlerBase { @@ -102,8 +101,8 @@ public class dbItemHandler extends dbHandlerBase {
flagString = flagString.replaceAll(";$", "");
preparedStatement.setString(9, flagString);
preparedStatement.setString(10, toAdd.name);
preparedStatement.setString(8, flagString);
preparedStatement.setString(9, toAdd.name);
ResultSet rs = preparedStatement.executeQuery();

Loading…
Cancel
Save