Hi Thomas The "Single Query Issue" is complex. I'll try to break this one down, because I think this one seams to be quite obvious and the code is unchanged in 6.2.0 beta1
DESCRIPTION: The function "msQueryByIndex(mapObj* map)" has a local variable "resultObj record;". The field "record.resultindex" is never initialized. In this function the uninitialized record-variable is passed to "msLayerGetShape(...,&record)". The Oracle-Implementation "msOracleSpatialLayerGetShape" of the msLayerGetShape-Function evaluates the uninitialized "record.resultindex". In my case "msOracleSpatialLayerGetShape" threw an error. SOLUTION (Suggestion): In msQueryByIndex resultObj record should be initialized. At least: record.resultindex = -1; >From a users point of view this error rises sporadic. Benedikt PS: I have some more frustrating issues of this kind. But this is the only one I can desribe precisly. thomas bonfort <[email protected]> schrieb am 02.08.2012 09:16:52: > thomas bonfort <[email protected]> > 02.08.2012 09:23 > > An > > [email protected] > > Kopie > > MapserverList OSGEO <[email protected]> > > Thema > > Re: [mapserver-users] Mapserver 6: Oracle & layerObj.queryByIndex > > Hi, > Issues https://github.com/mapserver/mapserver/issues/4238 and > https://github.com/mapserver/mapserver/issues/4076 seem closely > related. I'm not a query expert, but I do know that part of the code > has been quite heavily worked on for 6.2, any chance you could try > with that version and confirm if it has been fixed or not? > > regards, > thomas > > On Wed, Aug 1, 2012 at 4:51 PM, <[email protected]> wrote: > > > > > > Hi > > > > I'm porting an Java-Mapscript-application from Mapserver 5.4 to Mapserver > > 6.0. > > Data is stored in Oracle-Saptial. > > > > I have a problem with layerObj.queryByIndex. > > > > To illustrate, i use a small Java-Testprogram: > > import edu.umn.gis.mapscript.layerObj; > > import edu.umn.gis.mapscript.mapObj; > > import edu.umn.gis.mapscript.shapeObj; > > > > public class QueryExtent { > > public static void main(String argv []) { > > mapObj map = new mapObj("java_test\\umn.map"); > > layerObj l = map.getLayerByName("Gemeinden"); // Gemeinden is > > Oracle-Spatial-Layer > > int i = l.queryByIndex(map, 0, 2, 0); > > System.out.println(i); > > } > > > > } > > > > This program prints 1 - saying, that the queryByIndex-call was not > > successfull. > > Logfile: msOracleSpatialLayerGetShape(): OracleSpatial error. > > msOracleSpatialLayerGetShape record out of range > > > > By additional debugging I saw: In msOracleSpatialLayerGetShape Mapserver > > runs into the "if (resultindex >= 0)"-branch. > > In my case resultindex is an extra-ordinary big integer-number. > > > > I don't really understand ths query-layer-code in Mapserver. But I think in > > my case resultindex should by -1 and that Mapserver > > should initialize resultindex automatically. > > Therfore I changed code: > > int msQueryByIndex(mapObj *map) { > > ... > > resultObj record; > > record.resultindex = -1; // added line. > > } > > > > Is the fix correct or should I use Mapscript differently? > > > > Benedikt > > > > _______________________________________________ > > mapserver-users mailing list > > [email protected] > > http://lists.osgeo.org/mailman/listinfo/mapserver-users _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
