mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
...
This commit is contained in:
parent
9015213161
commit
65103e0ac1
@ -280,17 +280,17 @@ class PRST1(USBMS):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
|
|
||||||
debug_print("Removing Orphaned Collection Records")
|
debug_print("Removing Orphaned Collection Records")
|
||||||
|
|
||||||
# Purge any collections references that point into the abyss
|
# Purge any collections references that point into the abyss
|
||||||
query = 'DELETE FROM collections WHERE content_id NOT IN (SELECT _id FROM books)'
|
query = 'DELETE FROM collections WHERE content_id NOT IN (SELECT _id FROM books)'
|
||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
query = 'DELETE FROM collections WHERE collection_id NOT IN (SELECT _id FROM collection)'
|
query = 'DELETE FROM collections WHERE collection_id NOT IN (SELECT _id FROM collection)'
|
||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
|
|
||||||
debug_print("Removing Orphaned Book Records")
|
debug_print("Removing Orphaned Book Records")
|
||||||
|
|
||||||
# Purge any references to books not in this database
|
# Purge any references to books not in this database
|
||||||
# Idea is to prevent any spill-over where these wind up applying to some other book
|
# Idea is to prevent any spill-over where these wind up applying to some other book
|
||||||
query = 'DELETE FROM %s WHERE content_id NOT IN (SELECT _id FROM books)'
|
query = 'DELETE FROM %s WHERE content_id NOT IN (SELECT _id FROM books)'
|
||||||
@ -301,7 +301,7 @@ class PRST1(USBMS):
|
|||||||
cursor.execute(query%'history')
|
cursor.execute(query%'history')
|
||||||
cursor.execute(query%'layout_cache')
|
cursor.execute(query%'layout_cache')
|
||||||
cursor.execute(query%'preference')
|
cursor.execute(query%'preference')
|
||||||
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
except DatabaseError:
|
except DatabaseError:
|
||||||
import traceback
|
import traceback
|
||||||
@ -320,7 +320,7 @@ class PRST1(USBMS):
|
|||||||
query = 'SELECT last_insert_rowid()'
|
query = 'SELECT last_insert_rowid()'
|
||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
|
|
||||||
return long(row[0])
|
return long(row[0])
|
||||||
|
|
||||||
def get_database_min_id(self, source_id):
|
def get_database_min_id(self, source_id):
|
||||||
@ -376,6 +376,8 @@ class PRST1(USBMS):
|
|||||||
# Record what the max id being used is as well.
|
# Record what the max id being used is as well.
|
||||||
db_books = {}
|
db_books = {}
|
||||||
for i, row in enumerate(cursor):
|
for i, row in enumerate(cursor):
|
||||||
|
if row is None:
|
||||||
|
continue
|
||||||
lpath = row[0].replace('\\', '/')
|
lpath = row[0].replace('\\', '/')
|
||||||
db_books[lpath] = row[1]
|
db_books[lpath] = row[1]
|
||||||
if row[1] < sequence_min:
|
if row[1] < sequence_min:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user