I was actually trying to replace sqlite3mc 1.1.1 with 1.3.1 using WAL mode and some old database, but stumbled upon some issues. After narrowing down I found that WAL mode in general seems to be broken in release 1.3.1 (or 1.3.0).
Run this to create a new database (in the sqlite3mc shell provided in the binary download for win64):
.open newtest-wal1.db
pragma cipher=chacha20;
pragma key='123';
pragma journal_mode=wal;
create table test (x int);
begin immediate;
insert into test (x) values (1);
commit;
select * from test;
and you still get a result, but after re-opening the database again:
.open
.open newtest-wal1.db
pragma cipher=chacha20;
pragma key='123';
select * from test;
we're lost with a broken db:
Error: unsupported file format
My original attempt was to model our application code and switch back out of WAL mode before closing the db:
.open
.open newtest-wal2.db
pragma cipher=chacha20;
pragma key='123';
pragma journal_mode=wal;
create table test (x int);
begin immediate;
insert into test (x) values (1);
commit;
select * from test;
pragma journal_mode=delete;
which also fails, but with a different error message:
Error: database disk image is malformed
I was actually trying to replace sqlite3mc 1.1.1 with 1.3.1 using WAL mode and some old database, but stumbled upon some issues. After narrowing down I found that WAL mode in general seems to be broken in release 1.3.1 (or 1.3.0).
Run this to create a new database (in the sqlite3mc shell provided in the binary download for win64):
and you still get a result, but after re-opening the database again:
we're lost with a broken db:
Error: unsupported file formatMy original attempt was to model our application code and switch back out of WAL mode before closing the db:
which also fails, but with a different error message:
Error: database disk image is malformed