1
0
forked from MTSR/mapserver

code cleanup

This commit is contained in:
NatureFreshMilk 2019-01-25 10:19:30 +01:00
parent 349722e4b4
commit 8ee2a314ce
2 changed files with 20 additions and 15 deletions

View File

@ -0,0 +1,20 @@
package mapobjectdb
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
func NewSqliteAccessor(filename string) (*Sqlite3Accessor, error) {
//TODO: flag/config for unsafe db access
db, err := sql.Open("sqlite3", filename+"?_timeout=500&_journal_mode=MEMORY&_synchronous=OFF")
db.SetMaxOpenConns(1)
if err != nil {
return nil, err
}
sq := &Sqlite3Accessor{db: db, filename: filename}
return sq, nil
}

View File

@ -1,8 +1,6 @@
package mapobjectdb
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
"mapserver/coords"
)
@ -66,16 +64,3 @@ func (db *Sqlite3Accessor) RemoveTile(pos *coords.TileCoords) error {
_, err := db.db.Exec(removeTileQuery, pos.X, pos.Y, pos.Zoom, pos.LayerId)
return err
}
func NewSqliteAccessor(filename string) (*Sqlite3Accessor, error) {
//TODO: flag/config for unsafe db access
db, err := sql.Open("sqlite3", filename+"?_timeout=500&_journal_mode=MEMORY&_synchronous=OFF")
db.SetMaxOpenConns(1)
if err != nil {
return nil, err
}
sq := &Sqlite3Accessor{db: db, filename: filename}
return sq, nil
}