Fixed Database Entry Removal

This commit is contained in:
Eric 2015-09-06 14:10:50 +02:00
parent f1e034add0
commit 2f5945c536

View File

@ -54,7 +54,7 @@ public abstract class Database {
} }
public int getNextFreeID() { public int getNextFreeID() {
for (int i = 1; i <= getCount(); i++) { for (int i = 1; i < getCount() + 1; i++) {
if (getProduct(i) == null) { if (getProduct(i) == null) {
return i; return i;
} else { } else {
@ -131,6 +131,7 @@ public abstract class Database {
try { try {
conn = getSQLConnection(); conn = getSQLConnection();
ps = conn.prepareStatement("DELETE FROM " + table + " where id = " + id + ";"); ps = conn.prepareStatement("DELETE FROM " + table + " where id = " + id + ";");
ps.executeUpdate();
} catch (SQLException ex) { } catch (SQLException ex) {
plugin.getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex); plugin.getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex);
} finally { } finally {