Removed Collection system deletion query from store method.
This commit is contained in:
@@ -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,34 +14516,26 @@ 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))
|
_collections.forEach(data ->
|
||||||
{
|
{
|
||||||
st.setString(1, getAccountNamePlayer());
|
try
|
||||||
st.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
try (PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
|
|
||||||
{
|
|
||||||
_collections.forEach(data ->
|
|
||||||
{
|
{
|
||||||
try
|
st.setString(1, getAccountNamePlayer());
|
||||||
{
|
st.setInt(2, data.getItemId());
|
||||||
st.setString(1, getAccountNamePlayer());
|
st.setInt(3, data.getCollectionId());
|
||||||
st.setInt(2, data.getItemId());
|
st.setInt(4, data.getIndex());
|
||||||
st.setInt(3, data.getCollectionId());
|
st.addBatch();
|
||||||
st.setInt(4, data.getIndex());
|
}
|
||||||
st.addBatch();
|
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);
|
});
|
||||||
}
|
st.executeBatch();
|
||||||
});
|
con.commit();
|
||||||
st.executeBatch();
|
|
||||||
con.commit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,34 +14516,26 @@ 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))
|
_collections.forEach(data ->
|
||||||
{
|
{
|
||||||
st.setString(1, getAccountNamePlayer());
|
try
|
||||||
st.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
try (PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
|
|
||||||
{
|
|
||||||
_collections.forEach(data ->
|
|
||||||
{
|
{
|
||||||
try
|
st.setString(1, getAccountNamePlayer());
|
||||||
{
|
st.setInt(2, data.getItemId());
|
||||||
st.setString(1, getAccountNamePlayer());
|
st.setInt(3, data.getCollectionId());
|
||||||
st.setInt(2, data.getItemId());
|
st.setInt(4, data.getIndex());
|
||||||
st.setInt(3, data.getCollectionId());
|
st.addBatch();
|
||||||
st.setInt(4, data.getIndex());
|
}
|
||||||
st.addBatch();
|
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);
|
});
|
||||||
}
|
st.executeBatch();
|
||||||
});
|
con.commit();
|
||||||
st.executeBatch();
|
|
||||||
con.commit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,34 +14777,26 @@ 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))
|
_collections.forEach(data ->
|
||||||
{
|
{
|
||||||
st.setString(1, getAccountNamePlayer());
|
try
|
||||||
st.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
try (PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
|
|
||||||
{
|
|
||||||
_collections.forEach(data ->
|
|
||||||
{
|
{
|
||||||
try
|
st.setString(1, getAccountNamePlayer());
|
||||||
{
|
st.setInt(2, data.getItemId());
|
||||||
st.setString(1, getAccountNamePlayer());
|
st.setInt(3, data.getCollectionId());
|
||||||
st.setInt(2, data.getItemId());
|
st.setInt(4, data.getIndex());
|
||||||
st.setInt(3, data.getCollectionId());
|
st.addBatch();
|
||||||
st.setInt(4, data.getIndex());
|
}
|
||||||
st.addBatch();
|
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);
|
});
|
||||||
}
|
st.executeBatch();
|
||||||
});
|
con.commit();
|
||||||
st.executeBatch();
|
|
||||||
con.commit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,34 +14777,26 @@ 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))
|
_collections.forEach(data ->
|
||||||
{
|
{
|
||||||
st.setString(1, getAccountNamePlayer());
|
try
|
||||||
st.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
try (PreparedStatement st = con.prepareStatement(INSERT_COLLECTION))
|
|
||||||
{
|
|
||||||
_collections.forEach(data ->
|
|
||||||
{
|
{
|
||||||
try
|
st.setString(1, getAccountNamePlayer());
|
||||||
{
|
st.setInt(2, data.getItemId());
|
||||||
st.setString(1, getAccountNamePlayer());
|
st.setInt(3, data.getCollectionId());
|
||||||
st.setInt(2, data.getItemId());
|
st.setInt(4, data.getIndex());
|
||||||
st.setInt(3, data.getCollectionId());
|
st.addBatch();
|
||||||
st.setInt(4, data.getIndex());
|
}
|
||||||
st.addBatch();
|
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);
|
});
|
||||||
}
|
st.executeBatch();
|
||||||
});
|
con.commit();
|
||||||
st.executeBatch();
|
|
||||||
con.commit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user