[mapserver-dev] help! strange preserving invalid query in mapobject

BrainDrain paulborodaev at gmail.com
Fri Jun 6 07:55:17 EDT 2008


I use mapscript in c#, data from postgis, map file is correct. My web service
produce map image with mapObj.draw() method, mapObj stored in session state
object to prevent useless mapfile parsing every time calling web server. My
web app has an attribute query widget, which can initiate invalid query
string (filter) - sql where expression (just misprint for ex.). For ex. we
have empty (zero length) query string "" for table street_axis. that will
produce an an exception during layer.queryByAttributes(map, "", filter,
mapscript.MS_MULTIPLE). After! this error occurred I have an exception in my
web service (when requested by openlayers rich client js lib (by
zoomming/panning map)). This is expected:
  Message="msDrawMap(): Image handling error. Failed to draw layer named
'street_axis'.;prepare_database(): Query error. Error executing POSTGIS
DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR
SELECT
\"name\"::text,asbinary(force_collection(force_2d(geom)),'NDR'),id::text
from public.street_axis WHERE () and (geom && setSRID(
'BOX3D(240.340106037016 704.038663225639,418.96195656596
822.319350804203)'::BOX3D,find_srid('','public.street_axis','geom') ))'
\n\nPostgresql reports the error as 'ERROR:  syntax error at or near
\")\"\nLINE 1: ...)),'NDR'),id::text from public.street_axis WHERE () and
(geo...\ bla bla bla. But what can I do to reset this invalid query in my
map object??? remove it?
I tried many ways right before calling map.draw() method (with or without
catching query exception):
1) map.freeQuery(-1);
2) map.freeQuery for all layers;
3) turning on/off map.querymap.status;
4) map.drawQuery() instead of draw();
5) map.loadQuery with empty query (previously saved by 'clean' map);
6) PROCESSING "CLOSE_CONNECTION=DEFER" or without it (in map file);
7) opening/closing layers;
8) even !!! making new dummy valid query returning 0 records (something like
"id<0") on catching exception
 ... but nothing helped me!!!
Only the way I can use now is parsing mapObj from scratch from my temporary
saved map file? but i don't like it:).
-- 
View this message in context: http://www.nabble.com/help%21-strange-preserving-invalid-query-in-mapobject-tp17667367p17667367.html
Sent from the Mapserver - Dev mailing list archive at Nabble.com.



More information about the mapserver-dev mailing list