Fixes for in-memory databases
In-memory databases always allow write access and don't need to use lock files.
This commit is contained in:
parent
f75a8f9497
commit
46eb72d002
@ -587,6 +587,9 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
|||||||
Return True if we don't have read/write access to the database,
|
Return True if we don't have read/write access to the database,
|
||||||
otherwise return False (that is, we DO have read/write access)
|
otherwise return False (that is, we DO have read/write access)
|
||||||
"""
|
"""
|
||||||
|
# In-memory databases always allow write access.
|
||||||
|
if name == ':memory:':
|
||||||
|
return False
|
||||||
|
|
||||||
# See if we write to the target directory at all?
|
# See if we write to the target directory at all?
|
||||||
if not os.access(name, os.W_OK):
|
if not os.access(name, os.W_OK):
|
||||||
@ -616,7 +619,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
|||||||
|
|
||||||
self.readonly = mode == DBMODE_R
|
self.readonly = mode == DBMODE_R
|
||||||
|
|
||||||
if not self.readonly:
|
if not self.readonly and directory != ':memory:':
|
||||||
write_lock_file(directory)
|
write_lock_file(directory)
|
||||||
|
|
||||||
# run backend-specific code:
|
# run backend-specific code:
|
||||||
|
Loading…
Reference in New Issue
Block a user