Fix user save query inserting unique values multiple times
This commit is contained in:
parent
7603bc0db6
commit
fee6b5c72f
|
|
@ -414,7 +414,7 @@ public class Queries {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveUser(ChatUser user) {
|
public static void saveUser(ChatUser user) {
|
||||||
String query = "INSERT INTO chat_users (uuid, party_id, toggled_chat, toggled_gc) VALUES (?, ?, ?, ?)";
|
String query = "INSERT INTO chat_users (uuid, party_id, toggled_chat, toggled_gc) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE party_id = ?, toggled_chat = ?, toggled_gc = ?";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Connection connection = DatabaseConnection.getConnection();
|
Connection connection = DatabaseConnection.getConnection();
|
||||||
|
|
@ -424,6 +424,9 @@ public class Queries {
|
||||||
statement.setInt(2, user.getPartyId());
|
statement.setInt(2, user.getPartyId());
|
||||||
statement.setInt(3, user.toggledPartyChat() ? 1 : 0);
|
statement.setInt(3, user.toggledPartyChat() ? 1 : 0);
|
||||||
statement.setInt(4, user.isGcOn() ? 1 : 0);
|
statement.setInt(4, user.isGcOn() ? 1 : 0);
|
||||||
|
statement.setInt(5, user.getPartyId());
|
||||||
|
statement.setInt(6, user.toggledPartyChat() ? 1 : 0);
|
||||||
|
statement.setInt(7, user.isGcOn() ? 1 : 0);
|
||||||
|
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user