Hello,

well it seems that Postgres does not appreciate the non-escaped quotes in "name = 'name in ('Belgium')'".
I assume that "Belgium" is the recentering query string or something?

I don't know where this part of the SQL query is built but try to addslash() the incoming querystring in your plugin. There's a built-in static method available in CW for that: Utils::addslashes() => it adds slashes in front of quotes if it as detected that PHP magic_quotes are off.

Anyway your WHERE clause is kinda weird, isn't it? There's probably too many "name" in it...

AS

bram wrote:
Hi list,

I used the demoLocation plugin from the demoPlugins-project in myproject, which goes fine. But when I choose an item to recenter on a syntax error occurs. I can't imagine there still is a bug somewhere in a script so obviously I'm making a mistake somewhere. I tried other id_attributes_string & string/value combinations. Who knows what's going wrong?

Part of the mapfile:

 CONNECTIONTYPE POSTGIS
CONNECTION "dbname=edit_db host=localhost user=www-data password=a123 port=5432" DATA "the_geom from (select the_geom, area, gid, name, oid from countries where name < 'C') as foo2 using unique oid using SRID=-1"
 METADATA
       "exported_values" "recenter_name_string,id_attribute_string"
       "recenter_name_string" "name"
       "id_attribute_string" "name|string"
       "query_returned_attributes" "name area"


Errorreport:

Error in prepare_database(): Error executing POSTGIS DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT name::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),oid::text from (select the_geom, area, gid, name, oid from countries where name < 'C') as foo2 WHERE (name = 'name in ('Belgium')') and (the_geom && setSRID( 'BOX3D(-2843979.38207143 -1361319.536,2888428.68507143 2651366.111)'::BOX3D,-1) )' Postgresql reports the error as 'ERROR: syntax error at or near "Belgium" at character 227
'

Thanks for help!

Bram
_______________________________________________
Cartoweb-users mailing list
[email protected]
http://lists.maptools.org/mailman/listinfo/cartoweb-users
_______________________________________________
Cartoweb-users mailing list
[email protected]
http://lists.maptools.org/mailman/listinfo/cartoweb-users

Reply via email to