mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More robust creation of dynamic id filters
This commit is contained in:
parent
c4ee3b2950
commit
7eecfb0668
@ -106,6 +106,9 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
self.conn = connect(self.dbpath, self.row_factory)
|
||||
if self.user_version == 0:
|
||||
self.initialize_database()
|
||||
# remember to add any filter to the connect method in sqlite.py as well
|
||||
# so that various code taht connects directly will not complain about
|
||||
# missing functions
|
||||
self.books_list_filter = self.conn.create_dynamic_filter('books_list_filter')
|
||||
|
||||
def __init__(self, library_path, row_factory=False):
|
||||
@ -1469,7 +1472,6 @@ books_series_link feeds
|
||||
conn = ndb.conn
|
||||
conn.execute('create table temp_sequence(id INTEGER PRIMARY KEY AUTOINCREMENT)')
|
||||
conn.commit()
|
||||
conn.create_function(self.books_list_filter.name, 1, lambda x: 1)
|
||||
conn.executescript(sql)
|
||||
conn.commit()
|
||||
conn.execute('pragma user_version=%d'%user_version)
|
||||
|
@ -117,6 +117,8 @@ class DBThread(Thread):
|
||||
self.conn.create_aggregate('sort_concat', 2, SafeSortedConcatenate)
|
||||
self.conn.create_function('title_sort', 1, title_sort)
|
||||
self.conn.create_function('uuid4', 0, lambda : str(uuid.uuid4()))
|
||||
# Dummy functions for dynamically created filters
|
||||
self.conn.create_function('books_list_filter', 1, lambda x: 1)
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user