mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
T1 driver: Fix books sent to SD card sometimes resulting problems when deleted. Fixes #943586 (Transfert ebook on Micro SD - PRS T1 problem)
This commit is contained in:
parent
83139590f9
commit
f690dab1ff
@ -307,11 +307,21 @@ class PRST1(USBMS):
|
|||||||
|
|
||||||
# Work-around for Sony Bug (SD Card DB not using right SQLite sequence)
|
# Work-around for Sony Bug (SD Card DB not using right SQLite sequence)
|
||||||
if source_id == 1:
|
if source_id == 1:
|
||||||
|
# Update any existing sequence numbers in the table that aren't in the required range
|
||||||
sdcard_sequence_start = '4294967296'
|
sdcard_sequence_start = '4294967296'
|
||||||
query = 'UPDATE sqlite_sequence SET seq = ? WHERE seq < ?'
|
query = 'UPDATE sqlite_sequence SET seq = ? WHERE seq < ?'
|
||||||
t = (sdcard_sequence_start, sdcard_sequence_start,)
|
t = (sdcard_sequence_start, sdcard_sequence_start,)
|
||||||
cursor.execute(query, t)
|
cursor.execute(query, t)
|
||||||
|
|
||||||
|
# Insert sequence numbers for tables we will be manipulating, if they don't already exist
|
||||||
|
query = ('INSERT INTO sqlite_sequence (name, seq) '
|
||||||
|
'SELECT ?, ? '
|
||||||
|
'WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = ?)');
|
||||||
|
cursor.execute(query, ('books',sdcard_sequence_start,'books',))
|
||||||
|
cursor.execute(query, ('collection',sdcard_sequence_start,'collection',))
|
||||||
|
cursor.execute(query, ('collections',sdcard_sequence_start,'collections',))
|
||||||
|
|
||||||
|
|
||||||
for book in booklist:
|
for book in booklist:
|
||||||
# Run through plugboard if needed
|
# Run through plugboard if needed
|
||||||
if plugboard is not None:
|
if plugboard is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user