2019-02-05 15:13:34 +03:00
|
|
|
package postgres
|
|
|
|
|
2019-02-14 16:04:01 +03:00
|
|
|
const getBlocksByInitialTileQuery = `
|
|
|
|
select posx,posy,posz,data,mtime
|
|
|
|
from blocks b
|
2019-02-15 19:33:49 +03:00
|
|
|
where b.posx >= $1
|
2019-02-14 21:59:35 +03:00
|
|
|
and b.posy >= $2
|
|
|
|
and b.posz >= $3
|
|
|
|
and b.posx <= $4
|
|
|
|
and b.posy <= $5
|
|
|
|
and b.posz <= $6
|
2019-02-14 16:04:01 +03:00
|
|
|
`
|
|
|
|
|
2019-02-22 21:26:52 +03:00
|
|
|
const getBlockCountByInitialTileQuery = `
|
|
|
|
select count(*)
|
|
|
|
from blocks b
|
|
|
|
where b.posx >= $1
|
|
|
|
and b.posy >= $2
|
|
|
|
and b.posz >= $3
|
|
|
|
and b.posx <= $4
|
|
|
|
and b.posy <= $5
|
|
|
|
and b.posz <= $6
|
|
|
|
`
|
|
|
|
|
2019-02-05 15:13:34 +03:00
|
|
|
const getBlocksByMtimeQuery = `
|
2019-02-06 18:10:18 +03:00
|
|
|
select posx,posy,posz,data,mtime
|
2019-02-05 15:13:34 +03:00
|
|
|
from blocks b
|
2019-02-14 21:59:35 +03:00
|
|
|
where b.mtime > $1
|
2019-02-05 15:13:34 +03:00
|
|
|
order by b.mtime asc
|
2019-02-14 21:59:35 +03:00
|
|
|
limit $2
|
2019-02-05 15:13:34 +03:00
|
|
|
`
|
|
|
|
|
|
|
|
const countBlocksQuery = `
|
2019-02-14 21:59:35 +03:00
|
|
|
select count(*) from blocks where mtime >= $1 and mtime <= $2
|
2019-02-05 15:13:34 +03:00
|
|
|
`
|
|
|
|
|
2019-04-03 09:15:32 +03:00
|
|
|
const getTimestampQuery = `
|
|
|
|
select floor(EXTRACT(EPOCH from now()) * 1000)
|
|
|
|
`
|
|
|
|
|
2019-02-05 15:13:34 +03:00
|
|
|
const getBlockQuery = `
|
2019-02-14 11:09:04 +03:00
|
|
|
select posx,posy,posz,data,mtime from blocks b
|
2019-02-14 21:59:35 +03:00
|
|
|
where b.posx = $1
|
|
|
|
and b.posy = $2
|
|
|
|
and b.posz = $3
|
2019-02-05 15:13:34 +03:00
|
|
|
`
|