mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Speed up annotations_count_for_book
No need to use a transaction for a single readonly operation
This commit is contained in:
parent
3e53b5129b
commit
49e70ff532
@ -1949,10 +1949,9 @@ class DB(object):
|
||||
return changed
|
||||
|
||||
def annotation_count_for_book(self, book_id):
|
||||
with self.conn:
|
||||
c = self.execute('SELECT count(id) FROM annotations WHERE book=?', (book_id,))
|
||||
r = c.fetchone()[0]
|
||||
return r
|
||||
for (count,) in self.execute('SELECT count(id) FROM annotations WHERE book=?', (book_id,)):
|
||||
return count
|
||||
return 0
|
||||
|
||||
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())):
|
||||
|
Loading…
x
Reference in New Issue
Block a user