mapserver/mapobjectdb/sqlite/sql.go

56 lines
1.2 KiB
Go
Raw Normal View History

2019-02-05 15:25:01 +03:00
package sqlite
const getMapDataPosQuery = `
select o.id, o.type, o.mtime,
o.x, o.y, o.z,
o.posx, o.posy, o.posz,
oa.key, oa.value
from objects o
left join object_attributes oa on o.id = oa.objectid
where o.type = ?
and o.posx >= ? and o.posy >= ? and o.posz >= ?
and o.posx <= ? and o.posy <= ? and o.posz <= ?
order by o.id
`
const getMapDataWithAttributeLikePosQuery = `
select o.id, o.type, o.mtime,
o.x, o.y, o.z,
o.posx, o.posy, o.posz,
oa.key, oa.value
from objects o
left join object_attributes oa on o.id = oa.objectid
where o.id in (
select objectid from object_attributes where key = ? and value like ?
)
and o.type = ?
and o.posx >= ? and o.posy >= ? and o.posz >= ?
and o.posx <= ? and o.posy <= ? and o.posz <= ?
order by o.id
`
2019-02-05 15:25:01 +03:00
const removeMapDataQuery = `
delete from objects where posx = ? and posy = ? and posz = ?
`
const addMapDataQuery = `
insert into
objects(x,y,z,posx,posy,posz,type,mtime)
values(?, ?, ?, ?, ?, ?, ?, ?)
`
const addMapDataAttributeQuery = `
insert into
object_attributes(objectid, key, value)
values(?, ?, ?)
`
2019-02-07 10:21:19 +03:00
const getSettingQuery = `
select value from settings where key = ?
`
const setSettingQuery = `
2019-02-07 11:02:15 +03:00
insert or replace into settings(key, value)
values(?, ?)
2019-02-07 10:21:19 +03:00
`