rtutil: Avoid loading from a URI in RTLinkCache.setup.

See comments for rationale. RT#10543.
This commit is contained in:
Brett Smith 2020-05-13 10:48:09 -04:00
parent 66cd27e7f0
commit c1ecc48297

View file

@ -116,8 +116,13 @@ class RTLinkCache(_LinkCache):
db.close()
db = sqlite3.connect(':memory:', isolation_level=None)
cursor = db.cursor()
# It would better to use
# '{}?mode=ro'.format(cache_path.as_uri())
# as the argument here, but that doesn't work on SUSE 15,
# possibly because its sqlite doesn't recognize query
# arguments (added to upstream sqlite in late 2016).
cursor.execute('ATTACH DATABASE ? AS readsource',
('{}?mode=ro'.format(cache_path.as_uri()),))
(os.fspath(cache_path),))
cursor.execute(cls.CREATE_TABLE_SQL)
cursor.execute('INSERT INTO RTLinkCache SELECT * FROM readsource.RTLinkCache')
cursor.execute('DETACH DATABASE readsource')