From 1fb9f13dae38a202f853497e41e8e517c75f6eaf Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@qq.com> Date: Fri, 26 Jul 2019 21:37:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E8=AE=B0=E5=BD=95=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/arialyy/aria/orm/DBConfig.java | 2 +- .../main/java/com/arialyy/aria/orm/SqlHelper.java | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java b/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java index e50113e7..6bdddbd4 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java @@ -38,7 +38,7 @@ class DBConfig { static boolean DEBUG = false; static Map mapping = new LinkedHashMap<>(); static String DB_NAME; - static int VERSION = 52; + static int VERSION = 53; /** * 是否将数据库保存在Sd卡,{@code true} 是 diff --git a/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java b/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java index 1795cb79..4b2683db 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java @@ -100,7 +100,7 @@ final class SqlHelper extends SQLiteOpenHelper { handle360AriaUpdate(db); } else if (oldVersion < 51) { handle365Update(db); - } else if (oldVersion < 52) { + } else if (oldVersion < 53) { handle366Update(db); } else { handleDbUpdate(db, null, null); @@ -240,12 +240,9 @@ final class SqlHelper extends SQLiteOpenHelper { * 删除重复的repeat数据 */ private void delRepeatThreadRecord(SQLiteDatabase db) { - String repeatSql = - "DELETE FROM ThreadRecord WHERE (taskKey, threadId, endLocation) " - + "IN (SELECT taskKey, threadId, endLocation FROM ThreadRecord GROUP BY taskKey, threadId, endLocation " - + "HAVING COUNT(*) > 1) AND rowid " - + "NOT IN (SELECT MIN(rowid) FROM ThreadRecord GROUP BY taskKey, threadId, endLocation " - + "HAVING COUNT(*)> 1)"; + String repeatSql = "DELETE FROM ThreadRecord WHERE (rowid) " + + "IN (SELECT rowid FROM ThreadRecord GROUP BY taskKey, threadId, endLocation HAVING COUNT(*) > 1) " + + "AND rowid NOT IN (SELECT MIN(rowid) FROM ThreadRecord GROUP BY taskKey, threadId, endLocation HAVING COUNT(*)> 1)"; ALog.d(TAG, repeatSql); db.execSQL(repeatSql); } @@ -262,6 +259,7 @@ final class SqlHelper extends SQLiteOpenHelper { // 执行升级操作 handleDbUpdate(db, modifyMap, null); + delRepeatThreadRecord(db); } /**