<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello Karim,<br>
<br>
As I reported in my first mail, it is the first pair of quotes like in <b>'</b>France<b>'</b>
which induce the error.<br>
I tried <b>''</b>France<b>''</b>, with double single quote (<b>'</b>),
but it is also not working.<br>
<br>
Thanks anyway for the help.<br>
<br>
Julien<br>
<br>
alim karim wrote:
<blockquote
cite="mid:a91dec920808260852o23640a00x9f613422d6cf37f9@mail.gmail.com"
type="cite">
<div dir="ltr">Perhaps you can try escaping your quotes like so:<br>
<br>
'person's name' => 'person''s name'<br>
<br>
ak<br>
<br>
<div class="gmail_quote">On Tue, Aug 26, 2008 at 8:16 AM, julien <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:julien.trolet@ifremer.fr">julien.trolet@ifremer.fr</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
I am developing an interface for a PostreSQL/PostGIS (v8.2) database
using Mapserver (v 5.2.0) and Java (v6.0).<br>
I obtained some nice maps using a basic SQL query, inserted into the
mapfile.<br>
<br>
But as soon as I tried to <u>use some simple quote <b>'</b> or <b>\'</b></u>,
the server cannot draw the layer and report the following error :<br>
<br>
<pre>java.lang.UnknownError: msPOSTGISLayerRetrievePK(): Query error. Error executing POSTGIS statement (msPOSTGISLayerRetrievePK():select attname from pg_attribute, pg_constraint, pg_class where pg_constraint.conrelid = pg_class.oid and pg_class.oid = pg_attribute.attrelid and pg_constraint.contype = 'p' and pg_constraint.conkey[1] = pg_attribute.attnum and pg_class.relname = '<i><b>REQUEST REMOVED</b></i>' and pg_table_is_visible(pg_class.oid) and pg_constraint.conkey[2] is null
edu.umn.gis.mapscript.mapscriptJNI.layerObj_draw(Native Method)
edu.umn.gis.mapscript.layerObj.draw(layerObj.java:472)
fr.ird.remige.bean.MapFileBean$layerItemClass.draw(MapFileBean.java:617)
fr.ird.remige.bean.MapFileBean.draw(MapFileBean.java:1105)
</pre>
REQUEST REMOVED was something like :<br>
<pre>g_carre5 from (select distinct g_carre5 from carre
inner join date using (id_date)
inner join country using (id_country)
WHERE v_date BETWEEN 2000 AND 2001 AND <u><b>l_country='France'</b></u>
group by g_carre5) as foo</pre>
The previous request, which was working, was :<br>
<pre>g_carre5 from (select distinct g_carre5 from carre
inner join date using (id_date)
inner join country using (id_country)
WHERE v_date BETWEEN 2000 AND 2001 AND <u><b>v_country=1</b></u>
group by g_carre5) as foo</pre>
<u><br>
Table country :</u><br>
id_country serial primary key<br>
v_country numeric(4)<br>
l_country varchar(12)<br>
<br>
And first line is id_country = 1, v_country = 1, l_country = France.<br>
<br>
One strange thing is that, when I am using a mapfile script on my
computer (not on the server) and transform it into an image file with <b>shp2img</b>
(shell command), both requests are working. Moreover, both requests are
also working with SQL command, when logged into the database.<br>
<br>
In Java, the string containing the request is : "g_carre5 from (select
distinct g_carre5 from carre inner join date using (id_date) inner join
country using (id_country) WHERE v_date BETWEEN 2000 AND 2001 AND
l_country=\'France\' group by g_carre5) as foo". <br>
<br>
I also tried to replace <b>\' </b>by <b>\"</b>, and the expected
error <i><b>column "France" does not exist</b></i> was reported, which
shows that Libmapscript.so translated <b>\"</b> correctly.<br>
<br>
I do not understand why there is this quoting issue. Does somebody have
ever dealt with something like that?<br>
<br>
Julien<br>
<br>
</div>
<br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a moz-do-not-send="true"
href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>