mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix problem where db.set_author forced a recalculation of author_sort whenever editing metadata of a book with a unique author (only book with that author). The problem arose because the author was deleted from the DB then recreated, causing the trigger to be fired.
This commit is contained in:
parent
7e050c4d48
commit
8a027ac60c
@ -760,6 +760,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
||||
_('Could not open %s. Is it being used by another'
|
||||
' program?')%fname, show=True)
|
||||
raise
|
||||
self.db.clean()
|
||||
self.save_state()
|
||||
QDialog.accept(self)
|
||||
if callable(self.accepted_callback):
|
||||
|
@ -1126,7 +1126,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
if not authors:
|
||||
authors = [_('Unknown')]
|
||||
self.conn.execute('DELETE FROM books_authors_link WHERE book=?',(id,))
|
||||
self.conn.execute('DELETE FROM authors WHERE (SELECT COUNT(id) FROM books_authors_link WHERE author=authors.id) < 1')
|
||||
for a in authors:
|
||||
if not a:
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user