1
0
forked from MTSR/mapserver
mapserver/server/mapobjectdb/sqlite_new.go

20 lines
383 B
Go
Raw Normal View History

2019-01-25 12:19:30 +03:00
package mapobjectdb
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
func NewSqliteAccessor(filename string) (*Sqlite3Accessor, error) {
//TODO: flag/config for unsafe db access
2019-01-29 20:00:00 +03:00
db, err := sql.Open("sqlite3", filename+"?_timeout=500")
2019-01-25 12:19:30 +03:00
db.SetMaxOpenConns(1)
if err != nil {
return nil, err
}
sq := &Sqlite3Accessor{db: db, filename: filename}
return sq, nil
}