layerObj.queryByAttributes changed with Oracle
Benedikt Rothe
umn-ms at HYDROTEC.DE
Thu Nov 29 03:44:29 PST 2007
Hello List
I'm using Mapserer with Oracle/Java-Mapscript and migrating my app from
Mapserver 4.x to Mapserer 5.x
and have a problem with layerObj.queryByAttributes.
I used to query features with code like this:
alayerObj.queryByAttributes(aMapObj, "ID", "ID=4711", mapscript.
MS_SINGLE);
In Mapserver 5 this code results in an Mapserver-Error-Message stating,
that the "SQL command is not properly ended".
The Mapserver-generated SQL-Command includes a Where-Clause of the form
"ID = ID = 4711".
I had a look in maporaclespatial.c function "osFilteritem".
Follwing code seems to produce this Where-Clause:
if (layer->filteritem != NULL)
{
sprintf (query_str + strlen(query_str), " %s = ", layer->filteritem);
//snprintf (query_str + strlen(query_str), " %s = ",
layer->filteritem);
}
Changing my Java-Code to
alayerObj.queryByAttributes(aMapObj, "ID", "4711", mapscript.MS_SINGLE);
solves the problem.
Questions:
* Is this a bug in Mapserver or a new feature?
* Is this really a change in Mapserver 5.0?
* Shall I rather change my Java-Code or shall I patch Mapserver/
maporaclespatial.c/osFilteritem?
Would the changed Java-Code work with the Oracle-driver only?
Greetings from Aachen/Germany
Benedikt Rothe
Attachement "Error-Message": (Added Newlines)
msOracleSpatialLayerWhichShapes(): OracleSpatial error. Error: ORA-00933:
SQL command not properly ended
. Query statement:
SELECT
ID, ID, SHAPE
FROM
(select ID,SHAPE
FROM MYTABLE)
WHERE ID = ID = 4711 AND
SDO_FILTER(
SHAPE, MDSYS.SDO_GEOMETRY(2003, 82015,
NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),
MDSYS.SDO_ORDINATE_ARRAY(2501576.69,5621567,2503419.31,5622567)
),'querytype=window') = 'TRUE' .
Check your data statement.
Attachement "Part of mapfile":
# Projekte
LAYER
NAME "PROJEKT"
TYPE POINT
STATUS DEFAULT
#DEBUG ON
TEMPLATE "dummy.html"
CONNECTION "XXX/YYY at ZZZ"
CONNECTIONTYPE oraclespatial
DATA "SHAPE FROM (select ID,SHAPE FROM MYTABLE) using unique ID srid
82015"
CLASS
NAME ""
STYLE
COLOR 0 100 100
OUTLINECOLOR 0 0 0
SIZE 12
SYMBOL 'star'
END
END
END
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20071129/2cc2e7a0/attachment.htm>
More information about the MapServer-users
mailing list