bug fixes
This commit is contained in:
parent
7932ef8bc5
commit
da258dd365
1 changed files with 14 additions and 7 deletions
|
@ -55,13 +55,20 @@ public class SelfRoleTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean deleteData(long guildId, int page){
|
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();) {
|
||||||
try(Connection connection = database.connect(); PreparedStatement statement = connection.prepareStatement(sql)) {
|
String sql = "DELETE FROM self_role_data WHERE guild_id = ? AND page = ?;";
|
||||||
|
try(PreparedStatement statement = connection.prepareStatement(sql)){
|
||||||
statement.setLong(1, guildId);
|
statement.setLong(1, guildId);
|
||||||
statement.setInt(2, page);
|
statement.setInt(2, page);
|
||||||
statement.setLong(3, guildId);
|
statement.executeUpdate();
|
||||||
statement.setInt(4, page);
|
}
|
||||||
return statement.executeUpdate() != 0;
|
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) {
|
} catch (SQLException e) {
|
||||||
Ken.getInstance().getLogger().error("SQL Error: " + e.getMessage());
|
Ken.getInstance().getLogger().error("SQL Error: " + e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue