bug fixes

This commit is contained in:
Tyler Murphy 2022-09-04 10:54:59 -04:00
parent 7932ef8bc5
commit da258dd365

View file

@ -55,13 +55,20 @@ public class SelfRoleTable {
}
public boolean deleteData(long guildId, int page){
String sql = "DELETE FROM self_role_data WHERE guild_id = ? AND page = ?; UPDATE self_role_data SET page = page - 1 WHERE guild_id = ? AND page > ?;";
try(Connection connection = database.connect(); PreparedStatement statement = connection.prepareStatement(sql)) {
try(Connection connection = database.connect();) {
String sql = "DELETE FROM self_role_data WHERE guild_id = ? AND page = ?;";
try(PreparedStatement statement = connection.prepareStatement(sql)){
statement.setLong(1, guildId);
statement.setInt(2, page);
statement.setLong(3, guildId);
statement.setInt(4, page);
return statement.executeUpdate() != 0;
statement.executeUpdate();
}
sql = "UPDATE self_role_data SET page = page - 1 WHERE guild_id = ? AND page > ?;";
try(PreparedStatement statement = connection.prepareStatement(sql)){
statement.setLong(1, guildId);
statement.setInt(2, page);
statement.executeUpdate();
}
return true;
} catch (SQLException e) {
Ken.getInstance().getLogger().error("SQL Error: " + e.getMessage());
return false;