mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-15 14:50:21 +01:00
Fixed endless loop in Z order range query code in SQLite3 backend.
This commit is contained in:
parent
80113b885f
commit
470b47f70a
|
@ -327,12 +327,12 @@ func (ss *SqliteSession) interleavedSpatialQuery(first, second []byte, done chan
|
||||||
zmin, zmax = order(zmin, zmax)
|
zmin, zmax = order(zmin, zmax)
|
||||||
cub := common.Cuboid{P1: c1, P2: c2}
|
cub := common.Cuboid{P1: c1, P2: c2}
|
||||||
rangeStmt := ss.txStmt(ss.backend.rangeStmt)
|
rangeStmt := ss.txStmt(ss.backend.rangeStmt)
|
||||||
OUTER:
|
|
||||||
for {
|
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
rows *sql.Rows
|
rows *sql.Rows
|
||||||
)
|
)
|
||||||
|
loop:
|
||||||
|
// log.Printf("query %d %d\n", zmin, zmax)
|
||||||
if rows, err = rangeStmt.Query(zmin, zmax); err != nil {
|
if rows, err = rangeStmt.Query(zmin, zmax); err != nil {
|
||||||
log.Printf("Error in range query: %s\n", err)
|
log.Printf("Error in range query: %s\n", err)
|
||||||
return
|
return
|
||||||
|
@ -345,6 +345,7 @@ func (ss *SqliteSession) interleavedSpatialQuery(first, second []byte, done chan
|
||||||
rows.Close()
|
rows.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// log.Printf("zcode: %d\n", zcode)
|
||||||
c := common.InterleavedToCoord(zcode)
|
c := common.InterleavedToCoord(zcode)
|
||||||
if cub.Contains(c) {
|
if cub.Contains(c) {
|
||||||
var encodedKey []byte
|
var encodedKey []byte
|
||||||
|
@ -360,16 +361,16 @@ func (ss *SqliteSession) interleavedSpatialQuery(first, second []byte, done chan
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else { // Left the cuboid
|
} else { // Left the cuboid
|
||||||
|
// log.Printf("Left cuboid %d\n", zcode)
|
||||||
rows.Close()
|
rows.Close()
|
||||||
zmin = common.BigMin(zmin, zmax, zcode)
|
zmin = common.BigMin(zmin, zmax, zcode)
|
||||||
continue OUTER
|
goto loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err = rows.Err(); err != nil {
|
if err = rows.Err(); err != nil {
|
||||||
log.Printf("Error in range query: %s\n", err)
|
log.Printf("Error in range query: %s\n", err)
|
||||||
}
|
}
|
||||||
rows.Close()
|
rows.Close()
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user