forked from MTSR/mapserver
code cleanup
This commit is contained in:
parent
349722e4b4
commit
8ee2a314ce
20
server/mapobjectdb/sqlite_new.go
Normal file
20
server/mapobjectdb/sqlite_new.go
Normal 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
|
||||
}
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user