2019-02-05 15:25:01 +03:00
|
|
|
package sqlite
|
|
|
|
|
|
|
|
const getMapDataPosQuery = `
|
2023-12-27 12:35:24 +03:00
|
|
|
select o.uid, o.type, o.mtime,
|
2019-02-05 15:25:01 +03:00
|
|
|
o.x, o.y, o.z,
|
|
|
|
o.posx, o.posy, o.posz,
|
|
|
|
oa.key, oa.value
|
|
|
|
from objects o
|
2023-12-27 12:35:24 +03:00
|
|
|
left join object_attributes oa on o.uid = oa.object_uid
|
2019-02-05 15:25:01 +03:00
|
|
|
where o.type = ?
|
|
|
|
and o.posx >= ? and o.posy >= ? and o.posz >= ?
|
|
|
|
and o.posx <= ? and o.posy <= ? and o.posz <= ?
|
2023-12-27 12:35:24 +03:00
|
|
|
order by o.uid
|
2020-01-19 17:18:50 +03:00
|
|
|
limit ?
|
2019-02-05 15:25:01 +03:00
|
|
|
`
|
|
|
|
|
2019-04-14 22:13:59 +03:00
|
|
|
const getMapDataWithAttributeLikePosQuery = `
|
2023-12-27 12:35:24 +03:00
|
|
|
select o.uid, o.type, o.mtime,
|
2019-04-14 22:13:59 +03:00
|
|
|
o.x, o.y, o.z,
|
|
|
|
o.posx, o.posy, o.posz,
|
|
|
|
oa.key, oa.value
|
|
|
|
from objects o
|
2023-12-27 12:35:24 +03:00
|
|
|
left join object_attributes oa on o.uid = oa.object_uid
|
|
|
|
where o.uid in (
|
|
|
|
select object_uid from object_attributes where key = ? and value like ?
|
2019-04-14 22:13:59 +03:00
|
|
|
)
|
|
|
|
and o.type = ?
|
|
|
|
and o.posx >= ? and o.posy >= ? and o.posz >= ?
|
|
|
|
and o.posx <= ? and o.posy <= ? and o.posz <= ?
|
2023-12-27 12:35:24 +03:00
|
|
|
order by o.uid
|
2020-01-19 17:18:50 +03:00
|
|
|
limit ?
|
2019-04-14 22:13:59 +03:00
|
|
|
`
|
|
|
|
|
2023-12-27 12:35:24 +03:00
|
|
|
const removeMapDataAttributesQuery = `
|
|
|
|
delete from object_attributes where object_uid in (select uid from objects where posx = ? and posy = ? and posz = ?)
|
|
|
|
`
|
|
|
|
|
2019-02-05 15:25:01 +03:00
|
|
|
const removeMapDataQuery = `
|
|
|
|
delete from objects where posx = ? and posy = ? and posz = ?
|
|
|
|
`
|
|
|
|
|
|
|
|
const addMapDataQuery = `
|
|
|
|
insert into
|
2023-12-27 12:35:24 +03:00
|
|
|
objects(uid,x,y,z,posx,posy,posz,type,mtime)
|
|
|
|
values(?, ?, ?, ?, ?, ?, ?, ?, ?)
|
2019-02-05 15:25:01 +03:00
|
|
|
`
|
|
|
|
|
|
|
|
const addMapDataAttributeQuery = `
|
|
|
|
insert into
|
2023-12-27 12:35:24 +03:00
|
|
|
object_attributes(object_uid, key, value)
|
2019-02-05 15:25:01 +03:00
|
|
|
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
|
|
|
`
|