9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-19 14:59:21 +00:00

fix: missing placeholder %s in postgres

This commit is contained in:
William
2024-09-29 14:58:09 +01:00
parent 59ed77c169
commit 4df7d2def4

View File

@@ -330,13 +330,13 @@ public class PostgresDatabase extends Database {
try (PreparedStatement statement = connection.prepareStatement(formatStatementTables(""" try (PreparedStatement statement = connection.prepareStatement(formatStatementTables("""
WITH cte AS ( WITH cte AS (
SELECT id SELECT id
FROM user_data_table FROM %user_data_table%
WHERE player_uuid=? WHERE player_uuid=?
AND pinned=FALSE AND pinned=FALSE
ORDER BY timestamp ASC ORDER BY timestamp ASC
LIMIT %entry_count% LIMIT %entry_count%
) )
DELETE FROM user_data_table DELETE FROM %user_data_table%
WHERE id IN (SELECT id FROM cte);""".replace("%entry_count%", WHERE id IN (SELECT id FROM cte);""".replace("%entry_count%",
Integer.toString(unpinnedUserData.size() - maxSnapshots))))) { Integer.toString(unpinnedUserData.size() - maxSnapshots))))) {
statement.setObject(1, user.getUuid()); statement.setObject(1, user.getUuid());
@@ -434,7 +434,7 @@ public class PostgresDatabase extends Database {
public void wipeDatabase() { public void wipeDatabase() {
try (Connection connection = getConnection()) { try (Connection connection = getConnection()) {
try (Statement statement = connection.createStatement()) { try (Statement statement = connection.createStatement()) {
statement.executeUpdate(formatStatementTables("DELETE FROM \"%user_data_table%\";")); statement.executeUpdate(formatStatementTables("DELETE FROM %user_data_table%;"));
} }
} catch (SQLException e) { } catch (SQLException e) {
plugin.log(Level.SEVERE, "Failed to wipe the database", e); plugin.log(Level.SEVERE, "Failed to wipe the database", e);