Changeset - c1ecc4829722
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2020-05-13 14:48:09
brettcsmith@brettcsmith.org
rtutil: Avoid loading from a URI in RTLinkCache.setup.

See comments for rationale. RT#10543.
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/rtutil.py
Show inline comments
...
 
@@ -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')
0 comments (0 inline, 0 general)