Last active
August 4, 2024 10:13
-
-
Save andrewpetrochenkov/de4a252a0e7b0329b9f222f568972f9c to your computer and use it in GitHub Desktop.
sqlite database locked
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://stackoverflow.com/questions/2740806/python-sqlite-database-is-locked | |
function sqlite3() { | |
executable="$(which sqlite3)" || exit | |
out="$("$executable" "$@" 2>&1)" && echo "$out" && return || { | |
[[ "$out" == *"locked"* ]] && exit; echo "$out" 1>&2 && exit 1 | |
} | |
} | |
integrity_check="$(sqlite3 "$db" "pragma integrity_check;" 2> /dev/null)" || exit | |
[[ "$integrity_check" != "ok" ]] && echo "SKIP: integrity_check $integrity_check" && exit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment