Howard Kapustein wrote:
> Is it possible to use the CLI to read a WAL database and exit without
> modifying the database?

The checkpoint-on-close feature is not affected by
PRAGMA wal_autocheckpoint.  The NO_CKPT_ON_CLOSE DB config flag is the
only mechanism to prevent it from inside the connection.

However, the comment in sqlite3WalClose() says:

    /* If an EXCLUSIVE lock can be obtained on the database file (using the
    ** ordinary, rollback-mode locking methods, this guarantees that the
    ** connection associated with this log file is the only connection to
    ** the database. In this case checkpoint the database and unlink both
    ** the wal and wal-index files.

Well, using a second instance of the CLI to take a lock just kicks the
can down the road.

And I guess you don't simply want to kill the CLI.

> I'm effectively looking for a -readonly option, or how to achieve that
> net effect

sqlite3 "file:test.db?mode=ro"

But if you want to be really sure, set the file permissions to disallow
writes.  (You have to except the -shm file, and this is not officially
supported, and it appears there is a delay due to a lock timeout
somewhere.)


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to