Fix fetching of affected tables when mapnik tokens are used
We'll replace !bbox! with an empty box and !pixel_width! and !pixel_height! with 1 before passing the query to CDB_QueryTable
This commit is contained in:
@@ -105,7 +105,14 @@ module.exports = function(){
|
||||
|
||||
me.affectedTables = function (username, api_key, sql, callback) {
|
||||
|
||||
var sql = 'SELECT CDB_QueryTables($windshaft$' + sql + '$windshaft$)';
|
||||
// Replace mapnik tokens
|
||||
sql = sql.replace(RegExp('!bbox!', 'g'), 'ST_MakeEnvelope(0,0,0,0)')
|
||||
.replace(RegExp('!pixel_width!', 'g'), '1')
|
||||
.replace(RegExp('!pixel_height!', 'g'), '1')
|
||||
;
|
||||
|
||||
// Pass to CDB_QueryTables
|
||||
sql = 'SELECT CDB_QueryTables($windshaft$' + sql + '$windshaft$)';
|
||||
|
||||
// call sql api
|
||||
me.sqlQuery(username, api_key, sql, function(err, rows){
|
||||
|
||||
Reference in New Issue
Block a user