From 740dc1519781c6f028274f66db9e4853cc808745 Mon Sep 17 00:00:00 2001 From: xuelijun <977662702@qq.com> Date: Thu, 12 Feb 2026 10:29:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/tem/bocai/util/SQLiteUtil.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/tem/bocai/util/SQLiteUtil.java b/src/main/java/com/tem/bocai/util/SQLiteUtil.java index 28ca95f..a09116f 100644 --- a/src/main/java/com/tem/bocai/util/SQLiteUtil.java +++ b/src/main/java/com/tem/bocai/util/SQLiteUtil.java @@ -42,12 +42,25 @@ public class SQLiteUtil { // 先初始化数据库 //initDatabase(); - String insertSQL = """ + /*String insertSQL = """ INSERT OR REPLACE INTO lottery_results (issue,time, result, winner, gd1, gd2, sum1, sum2, glh_result) VALUES (?,?, ?, ?, ?, ?, ?, ?, ?) - """; - + """;*/ + String insertSQL = """ + INSERT INTO lottery_results + (issue, time, result, winner, gd1, gd2, sum1, sum2, glh_result) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) + ON CONFLICT(issue) DO UPDATE SET + time = excluded.time, + result = excluded.result, + winner = excluded.winner, + gd1 = excluded.gd1, + gd2 = excluded.gd2, + sum1 = excluded.sum1, + sum2 = excluded.sum2, + glh_result = excluded.glh_result + """; Connection conn = null; PreparedStatement pstmt = null;