浏览代码

handle duplicates

Tobias Simetsreiter 2 年之前
父节点
当前提交
95b9255222
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      multigource.py

+ 3 - 2
multigource.py

@@ -9,11 +9,12 @@ CREATE TABLE IF NOT EXISTS gourcelog (
     time DATETIME NOT NULL,
     time DATETIME NOT NULL,
    	user text,
    	user text,
 	action text,
 	action text,
-	path text
+	path text,
+    UNIQUE(time,user,action,path)
 );
 );
 '''
 '''
 STMT_INSERT='''
 STMT_INSERT='''
-INSERT INTO gourcelog VALUES (@time,@user,@action,@path)
+INSERT OR IGNORE INTO gourcelog VALUES (@time,@user,@action,@path)
 '''
 '''
 STMT_SELECT='''
 STMT_SELECT='''
 SELECT time,user,action,path FROM gourcelog ORDER BY time ASC
 SELECT time,user,action,path FROM gourcelog ORDER BY time ASC