mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Ticket #4369: sqlite 3 view: use 'immutable=1' URI parameter
...to prevent leaving wal/shm files after viewing sqlite database. The problem I often had with viewing .sqlite files with mc is that exiting the view mode mid-way may leave .wal/.shm files in the database directory. This never caused any actual issues, but a bit annoying, since leftover .wal files are often a sign that the program working with the database exited ungracefully. This effectively reproduces mc's behaviour: /tmp/testsqlite $ rm -f *-wal *-shm && sqlite3 "/tmp/testsqlite/db file.sqlite" .dump | head >/dev/null && ls -1 /tmp/testsqlite/ 'db file.sqlite' 'db file.sqlite-shm' 'db file.sqlite-wal' After the change -- no shm/wal files /tmp/testsqlite $ rm -f *-wal *-shm && sqlite3 "file:/tmp/testsqlite/db file.sqlite?immutable=1" .dump | head >/dev/null && ls -1 /tmp/testsqlite/ 'db file.sqlite' You can find the docs on immutable mode here: https://www.sqlite.org/uri.html#uriimmutable Immutable mode has been supported in sqlite since 2014: https://www.sqlite.org/changes.html#version_3_8_5 In case user's sqlite installation is older, the mode is just quietly ignored, so the change is backwards compatible. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
0091315adb
commit
ebbdc8847e
@ -39,7 +39,7 @@ do_view_action() {
|
|||||||
dbview -b "${MC_EXT_FILENAME}"
|
dbview -b "${MC_EXT_FILENAME}"
|
||||||
;;
|
;;
|
||||||
sqlite)
|
sqlite)
|
||||||
sqlite3 "${MC_EXT_FILENAME}" .dump
|
sqlite3 "file:${MC_EXT_FILENAME}?immutable=1" .dump
|
||||||
;;
|
;;
|
||||||
mo)
|
mo)
|
||||||
msgunfmt "${MC_EXT_FILENAME}" || \
|
msgunfmt "${MC_EXT_FILENAME}" || \
|
||||||
|
Loading…
Reference in New Issue
Block a user