mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
newdb: Fix dump and restore on non-ascii locales
Fix a bug in the new backend that broke the Check Library function on computers with non-English locales. Fixes #1215819 [version 1.0 vérification de la bibliothèque](https://bugs.launchpad.net/calibre/+bug/1215819) Upstream bug: https://code.google.com/p/apsw/issues/detail?id=142
This commit is contained in:
parent
9614b26137
commit
867a51daf2
2928
src/apsw_shell.py
Normal file
2928
src/apsw_shell.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -988,9 +988,10 @@ class DB(object):
|
||||
uv = int(self.user_version)
|
||||
|
||||
if sql is None:
|
||||
from apsw_shell import Shell
|
||||
callback(_('Dumping database to SQL') + '...')
|
||||
buf = StringIO()
|
||||
shell = apsw.Shell(db=self.conn, stdout=buf)
|
||||
shell = Shell(db=self.conn, stdout=buf)
|
||||
shell.process_command('.dump')
|
||||
sql = buf.getvalue()
|
||||
|
||||
|
@ -581,3 +581,13 @@ class WritingTest(BaseTest):
|
||||
cache.add_format(1, 'ADD', BytesIO(b'xxxx'))
|
||||
test_invalidate()
|
||||
# }}}
|
||||
|
||||
def test_dump_and_restore(self): # {{{
|
||||
' Test roundtripping the db through SQL '
|
||||
cache = self.init_cache()
|
||||
all_ids = cache.all_book_ids()
|
||||
cache.dump_and_restore()
|
||||
self.assertEqual(cache.set_field('title', {1:'nt'}), set([1]), 'database connection broken')
|
||||
cache = self.init_cache()
|
||||
self.assertEqual(cache.all_book_ids(), all_ids, 'dump and restore broke database')
|
||||
# }}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user