Removed Collection system deletion query from store method.

This commit is contained in:
MobiusDevelopment
2021-07-20 00:38:27 +00:00
parent 349014127c
commit c6700b3fcb
4 changed files with 68 additions and 104 deletions

View File

@@ -423,7 +423,6 @@ public class PlayerInstance extends Playable
private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE charId=? AND class_index=?"; private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE charId=? AND class_index=?";
// Character Collections list // Character Collections list
private static final String DELETE_COLLECTION = "DELETE FROM collections WHERE accountName=?";
private static final String INSERT_COLLECTION = "REPLACE INTO collections (`accountName`, `itemId`, `collectionId`, `index`) VALUES (?, ?, ?, ?)"; private static final String INSERT_COLLECTION = "REPLACE INTO collections (`accountName`, `itemId`, `collectionId`, `index`) VALUES (?, ?, ?, ?)";
private static final String RESTORE_COLLECTION = "SELECT * FROM collections WHERE accountName=? ORDER BY `index`"; private static final String RESTORE_COLLECTION = "SELECT * FROM collections WHERE accountName=? ORDER BY `index`";
private static final String DELETE_COLLECTION_FAVORITE = "DELETE FROM collection_favorites WHERE accountName=?"; private static final String DELETE_COLLECTION_FAVORITE = "DELETE FROM collection_favorites WHERE accountName=?";
@@ -14517,15 +14516,8 @@ public class PlayerInstance extends Playable
public void storeCollections() public void storeCollections()
{ {
try (Connection con = DatabaseFactory.getConnection()) try (Connection con = DatabaseFactory.getConnection();
{ PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
try (PreparedStatement st = con.prepareStatement(DELETE_COLLECTION))
{
st.setString(1, getAccountNamePlayer());
st.execute();
}
try (PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
{ {
_collections.forEach(data -> _collections.forEach(data ->
{ {
@@ -14545,7 +14537,6 @@ public class PlayerInstance extends Playable
st.executeBatch(); st.executeBatch();
con.commit(); con.commit();
} }
}
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.SEVERE, "Could not store collection for playerId " + getObjectId() + ": ", e); LOGGER.log(Level.SEVERE, "Could not store collection for playerId " + getObjectId() + ": ", e);

View File

@@ -423,7 +423,6 @@ public class PlayerInstance extends Playable
private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE charId=? AND class_index=?"; private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE charId=? AND class_index=?";
// Character Collections list // Character Collections list
private static final String DELETE_COLLECTION = "DELETE FROM collections WHERE accountName=?";
private static final String INSERT_COLLECTION = "REPLACE INTO collections (`accountName`, `itemId`, `collectionId`, `index`) VALUES (?, ?, ?, ?)"; private static final String INSERT_COLLECTION = "REPLACE INTO collections (`accountName`, `itemId`, `collectionId`, `index`) VALUES (?, ?, ?, ?)";
private static final String RESTORE_COLLECTION = "SELECT * FROM collections WHERE accountName=? ORDER BY `index`"; private static final String RESTORE_COLLECTION = "SELECT * FROM collections WHERE accountName=? ORDER BY `index`";
private static final String DELETE_COLLECTION_FAVORITE = "DELETE FROM collection_favorites WHERE accountName=?"; private static final String DELETE_COLLECTION_FAVORITE = "DELETE FROM collection_favorites WHERE accountName=?";
@@ -14517,15 +14516,8 @@ public class PlayerInstance extends Playable
public void storeCollections() public void storeCollections()
{ {
try (Connection con = DatabaseFactory.getConnection()) try (Connection con = DatabaseFactory.getConnection();
{ PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
try (PreparedStatement st = con.prepareStatement(DELETE_COLLECTION))
{
st.setString(1, getAccountNamePlayer());
st.execute();
}
try (PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
{ {
_collections.forEach(data -> _collections.forEach(data ->
{ {
@@ -14545,7 +14537,6 @@ public class PlayerInstance extends Playable
st.executeBatch(); st.executeBatch();
con.commit(); con.commit();
} }
}
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.SEVERE, "Could not store collection for playerId " + getObjectId() + ": ", e); LOGGER.log(Level.SEVERE, "Could not store collection for playerId " + getObjectId() + ": ", e);

View File

@@ -439,7 +439,6 @@ public class PlayerInstance extends Playable
private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE charId=? AND class_index=?"; private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE charId=? AND class_index=?";
// Character Collections list: // Character Collections list:
private static final String DELETE_COLLECTION = "DELETE FROM collections WHERE accountName=?";
private static final String INSERT_COLLECTION = "REPLACE INTO collections (`accountName`, `itemId`, `collectionId`, `index`) VALUES (?, ?, ?, ?)"; private static final String INSERT_COLLECTION = "REPLACE INTO collections (`accountName`, `itemId`, `collectionId`, `index`) VALUES (?, ?, ?, ?)";
private static final String RESTORE_COLLECTION = "SELECT * FROM collections WHERE accountName=? ORDER BY `index`"; private static final String RESTORE_COLLECTION = "SELECT * FROM collections WHERE accountName=? ORDER BY `index`";
private static final String DELETE_COLLECTION_FAVORITE = "DELETE FROM collection_favorites WHERE accountName=?"; private static final String DELETE_COLLECTION_FAVORITE = "DELETE FROM collection_favorites WHERE accountName=?";
@@ -14778,15 +14777,8 @@ public class PlayerInstance extends Playable
public void storeCollections() public void storeCollections()
{ {
try (Connection con = DatabaseFactory.getConnection()) try (Connection con = DatabaseFactory.getConnection();
{ PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
try (PreparedStatement st = con.prepareStatement(DELETE_COLLECTION))
{
st.setString(1, getAccountNamePlayer());
st.execute();
}
try (PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
{ {
_collections.forEach(data -> _collections.forEach(data ->
{ {
@@ -14806,7 +14798,6 @@ public class PlayerInstance extends Playable
st.executeBatch(); st.executeBatch();
con.commit(); con.commit();
} }
}
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.SEVERE, "Could not store collection for playerId " + getObjectId() + ": ", e); LOGGER.log(Level.SEVERE, "Could not store collection for playerId " + getObjectId() + ": ", e);

View File

@@ -439,7 +439,6 @@ public class PlayerInstance extends Playable
private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE charId=? AND class_index=?"; private static final String DELETE_CHAR_SHORTCUTS = "DELETE FROM character_shortcuts WHERE charId=? AND class_index=?";
// Character Collections list: // Character Collections list:
private static final String DELETE_COLLECTION = "DELETE FROM collections WHERE accountName=?";
private static final String INSERT_COLLECTION = "REPLACE INTO collections (`accountName`, `itemId`, `collectionId`, `index`) VALUES (?, ?, ?, ?)"; private static final String INSERT_COLLECTION = "REPLACE INTO collections (`accountName`, `itemId`, `collectionId`, `index`) VALUES (?, ?, ?, ?)";
private static final String RESTORE_COLLECTION = "SELECT * FROM collections WHERE accountName=? ORDER BY `index`"; private static final String RESTORE_COLLECTION = "SELECT * FROM collections WHERE accountName=? ORDER BY `index`";
private static final String DELETE_COLLECTION_FAVORITE = "DELETE FROM collection_favorites WHERE accountName=?"; private static final String DELETE_COLLECTION_FAVORITE = "DELETE FROM collection_favorites WHERE accountName=?";
@@ -14778,15 +14777,8 @@ public class PlayerInstance extends Playable
public void storeCollections() public void storeCollections()
{ {
try (Connection con = DatabaseFactory.getConnection()) try (Connection con = DatabaseFactory.getConnection();
{ PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
try (PreparedStatement st = con.prepareStatement(DELETE_COLLECTION))
{
st.setString(1, getAccountNamePlayer());
st.execute();
}
try (PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
{ {
_collections.forEach(data -> _collections.forEach(data ->
{ {
@@ -14806,7 +14798,6 @@ public class PlayerInstance extends Playable
st.executeBatch(); st.executeBatch();
con.commit(); con.commit();
} }
}
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.SEVERE, "Could not store collection for playerId " + getObjectId() + ": ", e); LOGGER.log(Level.SEVERE, "Could not store collection for playerId " + getObjectId() + ": ", e);