We'll use replace into and not insert into, #18.

This commit is contained in:
graywolf336 2014-02-20 21:07:06 -06:00
parent b26fed8f80
commit 1b2ed8bec4

View File

@ -416,7 +416,7 @@ public class JailIO {
cPS.close(); cPS.close();
Prisoner p = c.getPrisoner(); Prisoner p = c.getPrisoner();
PreparedStatement pPS = con.prepareStatement("INSERT INTO `" + prefix + "prisoners` (`name`, `jail`, `cell`, `muted`, `time`," PreparedStatement pPS = con.prepareStatement("REPLACE INTO `" + prefix + "prisoners` (`name`, `jail`, `cell`, `muted`, `time`,"
+ "`offlinePending`, `toBeTransferred`, `jailer`, `reason`, `inventory`, `armor`, `previousLocation`, `previousGameMode`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"); + "`offlinePending`, `toBeTransferred`, `jailer`, `reason`, `inventory`, `armor`, `previousLocation`, `previousGameMode`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)");
pPS.setString(1, p.getName()); pPS.setString(1, p.getName());
pPS.setString(2, j.getName()); pPS.setString(2, j.getName());
@ -446,7 +446,7 @@ public class JailIO {
if(con == null) this.prepareStorage(false); if(con == null) this.prepareStorage(false);
for(Prisoner p : j.getPrisonersNotInCells()) { for(Prisoner p : j.getPrisonersNotInCells()) {
PreparedStatement pPS = con.prepareStatement("INSERT INTO `" + prefix + "prisoners` (`name`, `jail`, `cell`, `muted`, `time`," PreparedStatement pPS = con.prepareStatement("REPLACE INTO `" + prefix + "prisoners` (`name`, `jail`, `cell`, `muted`, `time`,"
+ "`offlinePending`, `toBeTransferred`, `jailer`, `reason`, `inventory`, `armor`, `previousLocation`, `previousGameMode`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"); + "`offlinePending`, `toBeTransferred`, `jailer`, `reason`, `inventory`, `armor`, `previousLocation`, `previousGameMode`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)");
pPS.setString(1, p.getName()); pPS.setString(1, p.getName());
pPS.setString(2, j.getName()); pPS.setString(2, j.getName());