Dont modify database when no dirtied annotations are present

This commit is contained in:
Kovid Goyal 2020-06-12 19:36:57 +05:30
parent 3a9cc685dd
commit cda8dffc3a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 5 deletions

View File

@ -1795,11 +1795,12 @@ class DB(object):
save_annotations_for_book(self.conn.cursor(), book_id, fmt, annots_list, user_type, user) save_annotations_for_book(self.conn.cursor(), book_id, fmt, annots_list, user_type, user)
def dirty_books_with_dirtied_annotations(self): def dirty_books_with_dirtied_annotations(self):
self.execute(''' with self.conn:
INSERT or IGNORE INTO metadata_dirtied(book) SELECT book FROM annotations_dirtied; self.execute('INSERT or IGNORE INTO metadata_dirtied(book) SELECT book FROM annotations_dirtied;')
DELETE FROM annotations_dirtied; changed = self.conn.changes() > 0
''') if changed:
return self.conn.changes() > 0 self.execute('DELETE FROM annotations_dirtied')
return changed
def conversion_options(self, book_id, fmt): def conversion_options(self, book_id, fmt):
for (data,) in self.conn.get('SELECT data FROM conversion_options WHERE book=? AND format=?', (book_id, fmt.upper())): for (data,) in self.conn.get('SELECT data FROM conversion_options WHERE book=? AND format=?', (book_id, fmt.upper())):

Binary file not shown.