wal mode
This commit is contained in:
parent
6a62d14102
commit
27d12c20bc
@ -2,6 +2,7 @@ package sqlite
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
"mapserver/coords"
|
||||
"mapserver/db"
|
||||
"mapserver/public"
|
||||
@ -164,7 +165,7 @@ func (db *Sqlite3Accessor) GetBlock(pos *coords.MapBlockCoords) (*db.Block, erro
|
||||
}
|
||||
|
||||
func New(filename string) (*Sqlite3Accessor, error) {
|
||||
db, err := sql.Open("sqlite", "file:"+filename+"?mode=ro")
|
||||
db, err := sql.Open("sqlite", "file:"+filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -174,6 +175,11 @@ func New(filename string) (*Sqlite3Accessor, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = db.Exec("pragma journal_mode = wal;")
|
||||
if err != nil {
|
||||
return nil, errors.New("could not set db to wal-mode, please stop the minetest-server to allow this one-time fixup")
|
||||
}
|
||||
|
||||
sq := &Sqlite3Accessor{db: db, filename: filename}
|
||||
return sq, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user