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:
Charles Haley 2010-09-06 14:18:00 +01:00
parent 7e050c4d48
commit 8a027ac60c
2 changed files with 1 additions and 1 deletions

View File

@ -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):

View File

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