|
18 | 18 | @Singleton |
19 | 19 | public final class Database { |
20 | 20 | private static final String CREATE_SENTENCE = """ |
21 | | - CREATE TABLE IF NOT EXISTS last_server\ |
22 | | - (\ |
| 21 | + CREATE TABLE IF NOT EXISTS last_server(\ |
23 | 22 | `player` VARCHAR(20) NOT NULL PRIMARY KEY, \ |
24 | 23 | `server` VARCHAR(20) NOT NULL\ |
25 | 24 | ); |
@@ -62,17 +61,18 @@ public String lastServerOf(final String playerName) { |
62 | 61 |
|
63 | 62 | public void setLastServer(final String playerName, final String server) { |
64 | 63 | try (final Connection connection = this.source.getConnection(); |
65 | | - final PreparedStatement statement = connection.prepareStatement(INSERT_DATA); |
| 64 | + final PreparedStatement statement = connection.prepareStatement(INSERT_DATA) |
66 | 65 | ) { |
67 | 66 | statement.setString(1, playerName); |
68 | 67 | statement.setString(2, server); |
69 | 68 | statement.executeUpdate(); |
70 | 69 | } catch (final SQLException e) { |
71 | 70 | try (final Connection connection = this.source.getConnection(); |
72 | | - final PreparedStatement statement = connection.prepareStatement(UPDATE_SERVER); |
| 71 | + final PreparedStatement statement = connection.prepareStatement(UPDATE_SERVER) |
73 | 72 | ) { |
74 | 73 | statement.setString(1, server); |
75 | 74 | statement.setString(2, playerName); |
| 75 | + statement.executeUpdate(); |
76 | 76 | } catch (SQLException ex) { |
77 | 77 | this.logger.warn("An error occurred updating last server information of player {}", playerName, ex); |
78 | 78 | } |
|
0 commit comments