1
0
forked from MTSR/mapserver
This commit is contained in:
NatureFreshMilk 2019-01-25 11:18:35 +01:00
parent 75bf921b54
commit bd2f794af8
4 changed files with 5 additions and 8 deletions

View File

@ -19,15 +19,15 @@ type Tile struct {
type MapObject struct {
//mapblock position
MBPos *coords.MapBlockCoords `json:"mapblock"`
MBPos *coords.MapBlockCoords `json:"mapblock"`
//block position
X int `json:"x"`
Y int `json:"y"`
Z int `json:"z"`
Type string `json:"type"`
Mtime int64 `json:"mtime"`
Type string `json:"type"`
Mtime int64 `json:"mtime"`
Attributes map[string]string `json:"attributes"`
}
@ -49,7 +49,7 @@ type SearchQuery struct {
//mapblock position
Pos1 coords.MapBlockCoords `json:"pos1"`
Pos2 coords.MapBlockCoords `json:"pos2"`
Type string `json:"type"`
Type string `json:"type"`
}
type DBAccessor interface {

View File

@ -17,7 +17,6 @@ and o.posx <= ? and o.posy <= ? and o.posz <= ?
order by o.id
`
func (db *Sqlite3Accessor) GetMapData(q SearchQuery) ([]*MapObject, error) {
rows, err := db.db.Query(getMapDataPosQuery,
q.Type,
@ -43,7 +42,6 @@ func (db *Sqlite3Accessor) GetMapData(q SearchQuery) ([]*MapObject, error) {
var posx, posy, posz int
var key, value string
err = rows.Scan(&id, &Type, &mtime,
&x, &y, &z, &posx, &posy, &posz,
&key, &value,

View File

@ -5,7 +5,6 @@ import (
_ "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")

View File

@ -1,10 +1,10 @@
package mapobjectdb
import (
"fmt"
"io/ioutil"
"mapserver/coords"
"os"
"fmt"
"testing"
)