Fix ranking update query using a keyword for field name
"Rank" is a reserved keyword in MySQL 8. This caused an SQLSyntaxErrorException during the task run.
This commit is contained in:
@@ -48,7 +48,7 @@ public class RankingLoginTask implements Runnable {
|
||||
}
|
||||
|
||||
private void updateRanking(int job, int world) throws SQLException {
|
||||
String sqlCharSelect = "SELECT c.id, " + (job != -1 ? "c.jobRank, c.jobRankMove" : "c.rank, c.rankMove") + ", a.lastlogin AS lastlogin, a.loggedin FROM characters AS c LEFT JOIN accounts AS a ON c.accountid = a.id WHERE c.gm < 2 AND c.world = ? ";
|
||||
String sqlCharSelect = "SELECT c.id, " + (job != -1 ? "c.jobRank, c.jobRankMove" : "c.`rank`, c.rankMove") + ", a.lastlogin AS lastlogin, a.loggedin FROM characters AS c LEFT JOIN accounts AS a ON c.accountid = a.id WHERE c.gm < 2 AND c.world = ? ";
|
||||
if (job != -1) {
|
||||
sqlCharSelect += "AND c.job DIV 100 = ? ";
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class RankingLoginTask implements Runnable {
|
||||
}
|
||||
|
||||
try (ResultSet rs = charSelect.executeQuery();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (job != -1 ? "jobRank = ?, jobRankMove = ? " : "rank = ?, rankMove = ? ") + "WHERE id = ?")) {
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (job != -1 ? "jobRank = ?, jobRankMove = ? " : "`rank` = ?, rankMove = ? ") + "WHERE id = ?")) {
|
||||
int rank = 0;
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
Reference in New Issue
Block a user