Great, 1HuntnMan.
Actually, I am a little curious, did you trace on your code below?
...
try
// 1) Main R/W Connection
ConnectPMSDB.DatabaseName := PMS_DB;
ConnectPMSDB.Connected := True;
// 2) Pragmas (run AFTER connect)
ConnectPMSDB.ExecuteDirect('PRAGMA journal_mode=WAL;');
ConnectPMSDB.ExecuteDirect('PRAGMA synchronous=NORMAL;');
ConnectPMSDB.ExecuteDirect('PRAGMA foreign_keys=ON;');
ConnectPMSDB.ExecuteDirect('PRAGMA busy_timeout=5000;');
// 3) Transaction wiring (not starting StartTransaction here)
TransPMSDB.DataBase := ConnectPMSDB;
TransPMSDB.Action := caCommitRetaining;
TransPMSDB.Active:= True;
...
It should be error "transaction not set" on the line of
PRAGMA journal_mode.
If we change the code like below, we will have another error: "cannot change to into wal mode"
...
try
// 1) Main R/W Connection
ConnectPMSDB.DatabaseName := PMS_DB;
ConnectPMSDB.Connected := True;
// 3) Transaction wiring (not starting StartTransaction here)
TransPMSDB.DataBase := ConnectPMSDB;
TransPMSDB.Action := caCommitRetaining;
TransPMSDB.Active:= True;
// 2) Pragmas (run AFTER connect)
ConnectPMSDB.ExecuteDirect('PRAGMA journal_mode=WAL;');
...
You may want to skip
PRAGMA journal_mode line and see how it is going. I agree WAL is the recommended mode for multi connections or multithreaded. WAL helps such as running lengthy database processes (involves writing) in separate thread smoother. If the main thread tries reading the busy database, WAL works good preventing locking issues and maintains performance.
Usually we need a hack to change journal_mode. I use SQLite in my apps with journal mode WAL or TRUNCATE but I don't use SQLdb. Especially because I don't use Data Controls components in those apps.