Query from map table with more than one index.

mbtiles files often have two indexes on the map table. This doesn't
impact our ability to do an optimized query against it for ZXYStream.
This commit is contained in:
Will White
2014-12-13 11:13:13 -05:00
parent b09e1eb2b6
commit aa5f688407

View File

@@ -33,7 +33,7 @@ ZXYStream.prototype._read = function() {
if (!stream.table) {
return this.source._db.get("select count(1) as count from sqlite_master where type = 'index' and tbl_name = 'map';", function(err, row) {
if (err) return stream.emit('error', err);
stream.table = row.count === 1 ? 'map' : 'tiles';
stream.table = row.count >= 1 ? 'map' : 'tiles';
return stream._read();
});
}