修改插入

This commit is contained in:
xuelijun
2026-02-12 10:29:35 +08:00
parent 274f2a31af
commit 740dc15197

View File

@@ -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;