From 99b0d8f2b9ec980e650aacd0aa31d0a95017334a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 18 Aug 2010 12:24:58 -0600 Subject: [PATCH] Fix bug in new bulk tag edit function when adding already existing tags --- src/calibre/library/custom_columns.py | 2 +- src/calibre/library/database2.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/library/custom_columns.py b/src/calibre/library/custom_columns.py index f02294a102..60be09a193 100644 --- a/src/calibre/library/custom_columns.py +++ b/src/calibre/library/custom_columns.py @@ -377,7 +377,7 @@ class CustomColumns(object): if add: self.conn.execute( ''' - INSERT INTO {0}(book, value) SELECT {1}.id, {2}.id FROM {1}, {2} + INSERT OR REPLACE INTO {0}(book, value) SELECT {1}.id, {2}.id FROM {1}, {2} '''.format(link_table, temp_tables[0], temp_tables[1]) ) # get rid of the temp tables diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 6728735eb3..4b7a71aa64 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1434,7 +1434,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): if add: self.conn.execute( ''' - INSERT INTO books_tags_link(book, tag) SELECT {0}.id, {1}.id FROM + INSERT OR REPLACE INTO books_tags_link(book, tag) SELECT {0}.id, {1}.id FROM {0}, {1} '''.format(tables[0], tables[1]) )