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
|
return changed
|
||||||
|
|
||||||
def annotation_count_for_book(self, book_id):
|
def annotation_count_for_book(self, book_id):
|
||||||
with self.conn:
|
for (count,) in self.execute('SELECT count(id) FROM annotations WHERE book=?', (book_id,)):
|
||||||
c = self.execute('SELECT count(id) FROM annotations WHERE book=?', (book_id,))
|
return count
|
||||||
r = c.fetchone()[0]
|
return 0
|
||||||
return r
|
|
||||||
|
|
||||||
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())):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user