add support to change database location

This commit is contained in:
2021-01-17 21:15:57 +08:00
parent 94b652736f
commit b7e3d3d018
4 changed files with 9 additions and 5 deletions

View File

@@ -85,10 +85,10 @@ PRIMARY KEY (hash)
)''')
self._db.commit()
def __init__(self, m):
def __init__(self, m, loc: str):
self._version = [1, 0, 0, 0]
self._value_lock = Lock()
self._db = sqlite3.connect('data.db', check_same_thread=False)
self._db = sqlite3.connect(loc, check_same_thread=False)
ok = self.__check_database()
if not ok:
self.__create_table()