Skip to content
Commit 8b6cf027 authored by Yuanle Song's avatar Yuanle Song
Browse files

v0.101.0 redesign use of main and user database.

the old design have flaws and limitations. see :id001: and :id002: in
operational file.

new design:

open :memory: db readwrite, this will be the m_db handler.

try attach main db at known path (readonly if possible) to "maindb".
if failed, try next known path,
if all failed, initDB() should return false and gave up.

try attach user db at known path to "userdb" schema, if failed,
create :memory: db and initialize it as user db. attach it as "userdb"

update all query against main db to query from maindb.* table.
update all SQL against user db to run again userdb.* table.

- access to user db is concurrent safe. multiple libpyzy app won't overwrite
  user's user db file and lose data.
- there is no need to saveUserDB() using timer in the bg.
- there is no need to copy data from user db to :memory:, if user db is
  large, this can lower memory usage.
parent 95b8f0b6
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment