[pmapper-users] QueryEditor - query replace not working
Brought to you by:
arminburger
From: Pedro V. <ped...@ya...> - 2014-07-09 23:11:27
|
Hi, I found something strange in QueryEditor plugin. By doing a search like this [nome_1] ILIKE '%pedro%' OR [nome_2] ILIKE '%campos%' it does not give the expected result of the second clause. It seems to me that there may be a bug. The query POST is (firebug): &operation=query&layername=tipo&layerType=shape&query=[nome_1] ILIKE '%25pedro%' OR [nome_2] ILIKE '%campos%' and the pm_debug.log: [09-Jul-2014 23:17:25] P.MAPPER debug info Parameters for REQUEST array file: query.php->q_execAttributeQuery Array ( [operation] => query [layername] => tipo [layerType] => postgis [query] => [nome_1] ILIKE '%pedro%' OR [nome_2] ILIKE 'Êmpos%' [externalSearchDefinition] => 1 [mode] => search [layerName] => tipo [firstFld] => nome_1 [qStr] => nome_1 ~* 'pedro' OR nome_2 ~* '^Êmpos' ) [09-Jul-2014 23:17:25] P.MAPPER debug info P.MAPPER-DEBUG: squery.php/dumpPGQueryResults() - SQL Cmd: SELECT id, ST_xmin(box3d(the_geom)), ST_ymin(box3d(the_geom)), ST_xmax(box3d(the_geom)), ST_ymax(box3d(the_geom)), id,tipo,nome_1,nome_2,nome_3,comprada,observ FROM edificios.casas WHERE nome_1 ~* 'pedro' OR nome_2 ~* '^Êmpos' LIMIT 301 That is, it replaces "%campos%" by "Êmpos%". In fact, it replaces the "%ca" by "Ê" and "%ce" by "Î". And this is because this line on queryeditor.js query = query.replace('%','%25'); apparently only works for the first "%" of the first clause of WHERE. In the second clause, it does not replace the "%" by "%25", which will not prevent "%ca" to be replaced by "Ê". Anyone confirms? Thank you very much. Best regards, Pedro |