Hi folks,

When I was learning about rollback journal, I did the following tests:

(in shell 1)
$ sqlite3 /tmp/db.sqlite
SQLite version 3.21.0 2017-10-24 18:55:49
Enter ".help" for usage hints.
sqlite> PRAGMA journal_mode;
delete
sqlite> CREATE TABLE bank (name STR, money INT);
sqlite> INSERT INTO bank VALUES ("john", 5566);
sqlite> BEGIN;
sqlite> UPDATE bank SET money = money + 100 WHERE name = "john";
sqlite>

(then in shell 2)
$ kill -kill $(pidof sqlite3) # kills the sqlite3 process in shell 1
$ rm -f /tmp/db.sqlite-journal
$ sqlite3 /tmp/db.sqlite .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE bank (name STR, money INT);
INSERT INTO bank VALUES('john',5566);
COMMIT;

I was expecting that deleting the rollback journal would commit the
uncommitted transaction (i.e. increase money from 5566 to 5666). However,
it didn't.

I also noticed that the md5sum of db.sqlite are the same before the UPDATE
query and after it, which means that the UPDATE query doesn't really write
into db.sqlite. Does it only write into memory?

Thanks for answering my questions.

John Lin
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to