From 610cbf955d133fd0a50bf4b89d5ac798a4d167c7 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sun, 27 Jan 2019 11:45:41 +0200 Subject: [PATCH] [#900] Changed GROUP BY to group by world_name instead This fix has also been pushed on a more upstream branch, but to get a working version to the user this commit was made. --- .../databases/sql/tables/WorldTimesTable.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java index ef3e3bb59..bff0ee16e 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java @@ -178,7 +178,7 @@ public class WorldTimesTable extends UserUUIDTable { public WorldTimes getWorldTimesOfServer(UUID serverUUID) { String worldIDColumn = worldTable + "." + WorldTable.Col.ID; - String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world_name"; + String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world"; String sql = "SELECT " + "SUM(" + Col.SURVIVAL + ") as survival, " + "SUM(" + Col.CREATIVE + ") as creative, " + @@ -188,7 +188,7 @@ public class WorldTimesTable extends UserUUIDTable { " FROM " + tableName + " INNER JOIN " + worldTable + " on " + worldIDColumn + "=" + Col.WORLD_ID + " WHERE " + tableName + "." + Col.SERVER_UUID + "=?" + - " GROUP BY " + Col.WORLD_ID; + " GROUP BY world"; return query(new QueryStatement(sql, 1000) { @Override @@ -202,7 +202,7 @@ public class WorldTimesTable extends UserUUIDTable { WorldTimes worldTimes = new WorldTimes(new HashMap<>()); while (set.next()) { - String worldName = set.getString("world_name"); + String worldName = set.getString("world"); Map gmMap = new HashMap<>(); gmMap.put(gms[0], set.getLong("survival")); @@ -220,7 +220,7 @@ public class WorldTimesTable extends UserUUIDTable { public WorldTimes getWorldTimesOfUser(UUID uuid) { String worldIDColumn = worldTable + "." + WorldTable.Col.ID; - String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world_name"; + String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world"; String sql = "SELECT " + "SUM(" + Col.SURVIVAL + ") as survival, " + "SUM(" + Col.CREATIVE + ") as creative, " + @@ -230,7 +230,7 @@ public class WorldTimesTable extends UserUUIDTable { " FROM " + tableName + " INNER JOIN " + worldTable + " on " + worldIDColumn + "=" + Col.WORLD_ID + " WHERE " + Col.UUID + "=?" + - " GROUP BY " + Col.WORLD_ID; + " GROUP BY world"; return query(new QueryStatement(sql) { @Override @@ -244,7 +244,7 @@ public class WorldTimesTable extends UserUUIDTable { WorldTimes worldTimes = new WorldTimes(new HashMap<>()); while (set.next()) { - String worldName = set.getString("world_name"); + String worldName = set.getString("world"); Map gmMap = new HashMap<>(); gmMap.put(gms[0], set.getLong("survival")); @@ -262,7 +262,7 @@ public class WorldTimesTable extends UserUUIDTable { public Map getAllWorldTimesBySessionID() { String worldIDColumn = worldTable + "." + WorldTable.Col.ID; - String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world_name"; + String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world"; String sql = "SELECT " + Col.SESSION_ID + ", " + Col.SURVIVAL + ", " + @@ -282,7 +282,7 @@ public class WorldTimesTable extends UserUUIDTable { while (set.next()) { int sessionID = set.getInt(Col.SESSION_ID.get()); - String worldName = set.getString("world_name"); + String worldName = set.getString("world"); Map gmMap = new HashMap<>(); gmMap.put(gms[0], set.getLong(Col.SURVIVAL.get()));