minor sql fix

This commit is contained in:
Paldiu 2023-01-26 17:51:23 -06:00 committed by GitHub
parent 6ab35035b0
commit e70eef3b80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ public class DBUser {
public void insert(@NotNull PlayerData playerData) { public void insert(@NotNull PlayerData playerData) {
PreparedStatement statement = getConnection().prepareStatement("IF NOT EXISTS (SELECT 1 FROM users WHERE uuid = ?) " + PreparedStatement statement = getConnection().prepareStatement("IF NOT EXISTS (SELECT 1 FROM users WHERE uuid = ?) " +
"BEGIN INSERT INTO users (uuid, username, rank, play_time, coins, last_login) VALUES (?, ?, ?, ?, ?, ?) END " + "BEGIN INSERT INTO users (uuid, username, rank, play_time, coins, last_login) VALUES (?, ?, ?, ?, ?, ?) END " +
"ELSE BEGIN (UPDATE users SET username = ?, rank = ?, play_time = ?, coins = ?, last_login = ? WHERE uuid = ?) END;"); "ELSE BEGIN UPDATE users SET username = ?, rank = ?, play_time = ?, coins = ?, last_login = ? WHERE uuid = ? END;");
statement.setString(1, playerData.getUuid().toString()); statement.setString(1, playerData.getUuid().toString());
statement.setString(2, playerData.getUuid().toString()); statement.setString(2, playerData.getUuid().toString());