2DU 8 лет назад
Родитель
Сommit
7aa870a097
1 измененных файлов с 7 добавлено и 5 удалено
  1. 7 5
      mark.py

+ 7 - 5
mark.py

@@ -389,13 +389,15 @@ def toc_pas(data, title, num, toc_y):
 
 def backlink_plus(name, link, backtype, num):
     if(num == 1):       
-        curs.execute("delete from back where title = ? and link = ? and type = ?", [link, name, backtype])
-        curs.execute("insert into back (title, link, type) values (?, ?,  ?)", [link, name, backtype])
+        curs.execute("select title from back where title = ? and link = ? and type = ?", [link, name, backtype])
+        if(not curs.fetchall()):
+            curs.execute("insert into back (title, link, type) values (?, ?,  ?)", [link, name, backtype])
 
 def cat_plus(name, link, num):
-    if(num == 1):        
-        curs.execute("delete from cat where title = ? and cat = ?", [link, name])
-        curs.execute("insert into cat (title, cat) values (?, ?)", [link, name])
+    if(num == 1):
+        curs.execute("select title from cat where title = ? and cat = ?", [link, name])
+        if(not curs.fetchall()):
+            curs.execute("insert into cat (title, cat) values (?, ?)", [link, name])
 
 def namumark(title, data, num, in_c, toc_y):    
     data = re.sub("\n", "\r\n", re.sub("\r\n", "\n", data))