mapserver/mapobjectdb/sqlite/new.go
Buckaroo Banzai be38c83fd8
db cleanup (#341)
* db cleanup

* dev

* pg setup

* postgres uuid migration

* cleanup

* fk

* sqlite migration

* cleanup

* wal

* max open conns = 1

* fix panic

---------

Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
2023-12-27 10:35:24 +01:00

23 lines
344 B
Go

package sqlite
import (
"database/sql"
_ "modernc.org/sqlite"
)
func New(filename string) (*Sqlite3Accessor, error) {
db, err := sql.Open("sqlite", filename+"?_pragma=busy_timeout(30000)")
if err != nil {
return nil, err
}
err = EnableWAL(db)
if err != nil {
return nil, err
}
sq := &Sqlite3Accessor{db: db}
return sq, nil
}