Skip to content
Snippets Groups Projects
Commit 66d7bf5f authored by ale's avatar ale
Browse files

Be nicer when auto-enabling sqlite WAL

parent 6f52d865
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package sqlite
import (
"database/sql"
"strings"
"time"
ippb "git.autistici.org/ai3/tools/iprep/proto"
......@@ -30,7 +31,11 @@ type DB struct {
}
func Open(path string) (*DB, error) {
db, err := sqlOpen(path + "?_journal=WAL")
// Auto-enable SQLite WAL.
if !strings.Contains(path, "?") {
path += "?_journal=WAL"
}
db, err := sqlOpen(path)
if err != nil {
return nil, err
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment