Fix exception in get_categories caused by quotes in identifier names

This commit is contained in:
Charles Haley 2011-06-02 07:18:25 +01:00
parent 5f8db566bc
commit 26d90debf0

View File

@ -1556,13 +1556,13 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
if ids is not None: if ids is not None:
count = self.conn.get('''SELECT COUNT(id) count = self.conn.get('''SELECT COUNT(id)
FROM data FROM data
WHERE format="%s" AND WHERE format=? AND
books_list_filter(book)'''%fmt, books_list_filter(book)''', (fmt,),
all=False) all=False)
else: else:
count = self.conn.get('''SELECT COUNT(id) count = self.conn.get('''SELECT COUNT(id)
FROM data FROM data
WHERE format="%s"'''%fmt, WHERE format=?''', (fmt,),
all=False) all=False)
if count > 0: if count > 0:
categories['formats'].append(Tag(fmt, count=count, icon=icon, categories['formats'].append(Tag(fmt, count=count, icon=icon,
@ -1584,13 +1584,13 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
if ids is not None: if ids is not None:
count = self.conn.get('''SELECT COUNT(book) count = self.conn.get('''SELECT COUNT(book)
FROM identifiers FROM identifiers
WHERE type="%s" AND WHERE type=? AND
books_list_filter(book)'''%ident, books_list_filter(book)''', (ident,),
all=False) all=False)
else: else:
count = self.conn.get('''SELECT COUNT(id) count = self.conn.get('''SELECT COUNT(id)
FROM identifiers FROM identifiers
WHERE type="%s"'''%ident, WHERE type=?''', (ident,),
all=False) all=False)
if count > 0: if count > 0:
categories['identifiers'].append(Tag(ident, count=count, icon=icon, categories['identifiers'].append(Tag(ident, count=count, icon=icon,