mapserver/server/mapobjectdb/sqlite/new.go

19 lines
322 B
Go
Raw Normal View History

2019-02-05 15:25:01 +03:00
package sqlite
2019-01-25 12:19:30 +03:00
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
2019-02-05 15:25:01 +03:00
func New(filename string) (*Sqlite3Accessor, error) {
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
}