From f466184fae1e90e2efc20752bb0fe999e8ea8af5 Mon Sep 17 00:00:00 2001 From: XUANXUQAQ Date: Tue, 26 Sep 2023 15:04:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../services/utils/connection/SQLiteUtil.java | 31 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index de65bb203..f094dfaee 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ github.fileengine File-Engine - 4.2 + 4.3 mulesoft diff --git a/src/main/java/file/engine/services/utils/connection/SQLiteUtil.java b/src/main/java/file/engine/services/utils/connection/SQLiteUtil.java index fee6409e9..b2a717d9a 100644 --- a/src/main/java/file/engine/services/utils/connection/SQLiteUtil.java +++ b/src/main/java/file/engine/services/utils/connection/SQLiteUtil.java @@ -414,24 +414,29 @@ private static void createPriorityTable() throws SQLException { try (Statement statement = getStatement("cache")) { int row = statement.executeUpdate("CREATE TABLE IF NOT EXISTS priority(SUFFIX text unique, PRIORITY INT);"); if (row == 0) { - int count = 10; - HashMap map = new HashMap<>(); - map.put("lnk", count--); - map.put("exe", count--); - map.put("bat", count--); - map.put("cmd", count--); - map.put("txt", count--); - map.put("docx", count--); - map.put("zip", count--); - map.put("rar", count--); - map.put("7z", count--); - map.put("html", count); - map.put("defaultPriority", 0); + HashMap map = generateSuffixPriorityMap(); insertAllSuffixPriority(map, statement); } } } + private static HashMap generateSuffixPriorityMap() { + int count = 10; + HashMap map = new HashMap<>(); + map.put("lnk", count--); + map.put("exe", count--); + map.put("bat", count--); + map.put("cmd", count--); + map.put("txt", count--); + map.put("docx", count--); + map.put("zip", count--); + map.put("rar", count--); + map.put("7z", count--); + map.put("html", count); + map.put("defaultPriority", 0); + return map; + } + private static void createCacheTable() throws SQLException { try (PreparedStatement pStmt = getPreparedStatement("CREATE TABLE IF NOT EXISTS cache(PATH text unique);", "cache")) { pStmt.executeUpdate();