mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-15 10:55:20 +01:00
Remove unnecessary replaceAll
This commit is contained in:
parent
ad22323fce
commit
6f6106fe62
@ -38,7 +38,7 @@ public MySQL(@NotNull Minepacks plugin, @Nullable ConnectionProvider connectionP
|
||||
protected void updateQueriesForDialect()
|
||||
{
|
||||
queryDeleteOldBackpacks = "DELETE FROM {TableBackpacks} WHERE {FieldBPLastUpdate} + INTERVAL {VarMaxAge} day < NOW()";
|
||||
queryUpdateBp = queryUpdateBp.replaceAll("\\{NOW}", "NOW()");
|
||||
queryUpdateBp = queryUpdateBp.replace("{NOW}", "NOW()");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,6 +32,7 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public abstract class SQL extends Database
|
||||
{
|
||||
@ -163,10 +164,10 @@ protected void setTableAndFieldNames()
|
||||
protected String replacePlaceholders(@Language("SQL") String query)
|
||||
{
|
||||
return query.replaceAll("(\\{\\w+})", "`$1`").replaceAll("`(\\{\\w+})`_(\\w+)", "`$1_$2`").replaceAll("fk_`(\\{\\w+})`_`(\\{\\w+})`_`(\\{\\w+})`", "`fk_$1_$2_$3`") // Fix name formatting
|
||||
.replaceAll("\\{TablePlayers}", tablePlayers).replaceAll("\\{FieldName}", fieldPlayerName).replaceAll("\\{FieldUUID}", fieldPlayerUUID).replaceAll("\\{FieldPlayerID}", fieldPlayerID) // Players
|
||||
.replaceAll("\\{TableBackpacks}", tableBackpacks).replaceAll("\\{FieldBPOwner}", fieldBpOwner).replaceAll("\\{FieldBPITS}", fieldBpIts) // Backpacks
|
||||
.replaceAll("\\{FieldBPVersion}", fieldBpVersion).replaceAll("\\{FieldBPLastUpdate}", fieldBpLastUpdate) // Backpacks
|
||||
.replaceAll("\\{TableCooldowns}", tableCooldowns).replaceAll("\\{FieldCDPlayer}", fieldCdPlayer).replaceAll("\\{FieldCDTime}", fieldCdTime); // Cooldowns
|
||||
.replace("{TablePlayers}", tablePlayers).replace("{FieldName}", fieldPlayerName).replace("{FieldUUID}", fieldPlayerUUID).replace("{FieldPlayerID}", fieldPlayerID) // Players
|
||||
.replace("{TableBackpacks}", tableBackpacks).replace("{FieldBPOwner}", fieldBpOwner).replace("{FieldBPITS}", fieldBpIts) // Backpacks
|
||||
.replace("{FieldBPVersion}", fieldBpVersion).replace("{FieldBPLastUpdate}", fieldBpLastUpdate) // Backpacks
|
||||
.replace("{TableCooldowns}", tableCooldowns).replace("{FieldCDPlayer}", fieldCdPlayer).replace("{FieldCDTime}", fieldCdTime); // Cooldowns
|
||||
}
|
||||
|
||||
protected void runStatementAsync(final String query, final Object... args)
|
||||
@ -186,8 +187,7 @@ protected void runStatement(final String query, final Object... args)
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
plugin.getLogger().severe("Query: " + query);
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().log(Level.SEVERE, e, () -> "Query: " + query);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user