From 9972090f0c4786667bcd5d1c4dec920de6d2f18c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 11 Dec 2011 10:47:02 +0530 Subject: [PATCH] Fix regression in 0.8.30 that broke bulk conversion of a single book. Fixes #902506 (Error if trying to bulk convert with one book selected) --- src/calibre/library/database.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/library/database.py b/src/calibre/library/database.py index fc29df5f02..0e2bd5876b 100644 --- a/src/calibre/library/database.py +++ b/src/calibre/library/database.py @@ -1089,8 +1089,12 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE; ids = tuple(ids) if len(ids) > 50000: return True + if len(ids) == 1: + ids = '(%d)'%ids[0] + else: + ids = repr(ids) return self.conn.get(''' - SELECT data FROM conversion_options WHERE book IN %r AND + SELECT data FROM conversion_options WHERE book IN %s AND format=? LIMIT 1'''%(ids,), (format,), all=False) is not None def delete_conversion_options(self, id, format, commit=True):