From 5299314fb492e330f25067f1bcbcffac065911ae Mon Sep 17 00:00:00 2001 From: javi Date: Tue, 17 Nov 2015 11:12:28 +0100 Subject: [PATCH] fixed sql generation where threre is not filter --- lib/torque/provider/filterableJson.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/torque/provider/filterableJson.js b/lib/torque/provider/filterableJson.js index 9d30daf..ecd5cb0 100644 --- a/lib/torque/provider/filterableJson.js +++ b/lib/torque/provider/filterableJson.js @@ -424,8 +424,11 @@ var Profiler = require('../profiler'); "and (((quadkey_y & (255 << {shift})) >> {shift}) - {torque_tile_y}) between -{tolerance} and {tolerance} " ] - if(applyFilters) { - sql.push("and (" + this._generateFiltersSQL(false) + ")"); + if (applyFilters) { + var f = this._generateFiltersSQL(false); + if (f.length) { + sql.push("and (" + f + ")"); + } } sql.push("limit {maxNo}");