From 4f82be9691b8240a8a7dae0c1654e5566c17edd1 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 25 May 2019 18:02:56 -0400 Subject: [PATCH] xtea service: fix bulk query returning duplicates Some rows have backfilled times that are duplicates, causing the join to join multiple rows. Assume ids only increment and fetch the row with the highest id instead, and join on id. --- .../java/net/runelite/http/service/xtea/XteaService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/xtea/XteaService.java b/http-service/src/main/java/net/runelite/http/service/xtea/XteaService.java index 92ec5a6dd8..61650b4e51 100644 --- a/http-service/src/main/java/net/runelite/http/service/xtea/XteaService.java +++ b/http-service/src/main/java/net/runelite/http/service/xtea/XteaService.java @@ -184,9 +184,9 @@ public class XteaService try (Connection con = sql2o.open()) { return con.createQuery( - "select t1.region, t1.time, t2.rev, t2.key1, t2.key2, t2.key3, t2.key4 from " + - "(select region,max(time) as time from xtea group by region) t1 " + - "join xtea t2 on t1.region = t2.region and t1.time = t2.time") + "select t1.region, t2.time, t2.rev, t2.key1, t2.key2, t2.key3, t2.key4 from " + + "(select region,max(id) as id from xtea group by region) t1 " + + "join xtea t2 on t1.id = t2.id") .executeAndFetch(XteaEntry.class); } }