MapServer / MapServer-import

3 stars 2 forks source link

QueryByAttributes with Sde Layers #2189

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: dstajan Date: 2007/07/31 - 00:32 I have been developing a website for Mapserver using c# mapscript. I have also been using sde data in my map. One thing I have noticed are errors that occur when you try to use the QueryByAttributes layer method on an sde layer.

The mserror reads Message: "msSDELayerNextShape(): SDE error. SE_stream_fetch(): Underlying DBMS error. (-51)" String

I started digging into the sde logs and found that the sql being generated by the command had an incorrect where clause. It was basically ignoring the column name and trying to search for the the value only. example: instead of 'where objectid=86' the log was showing 'where (86)'.

Back to the mapscript i was able to work around the problem by calling the method differently than I would when using shapefiles.

For example, when calling the method for a shapefile this syntax works: layer.queryByAttributes(pMap, "OBJECTID", "86", mapscript.MS_SINGLE) but for sde layers this syntax works: layer.queryByAttributes(pMap, "OBJECTID", "OBJECTID=86", mapscript.MS_SINGLE).

By reviewing other code snipets it seems that the syntax commonly used is the shapefile example I displayed above. I believe that method should be called the same regardless of the data format used. As it is I now have to evaluate the data type before running thsi command in order to ensure the right syntax.

Thanks, David

tbonfort commented 12 years ago

Author: hobu Date: 2007/08/16 - 08:18 Steve,

Did SDE ever do this before?

Howard

tbonfort commented 12 years ago

Author: sdlime Date: 2007/08/16 - 20:39 I believe so. It was one of the things I needed when I originally added the SDE support. We should review how PostGIS works and mimic that. The idea is that the attribute query is handled by the underlying DBMS and not MapServer so it should be fast with SDE, Oracle and PostGIS drivers.

Steve

Schpidi commented 11 years ago

This is an automated comment

This issue has been closed due to lack of activity. This doesn't mean the issue is invalid, it simply got no attention within the last year. Please reopen if still valid.