Opened 17 years ago
Last modified 17 years ago
#2189 new defect
QueryByAttributes with Sde Layers
Reported by: | dstajan | Owned by: | hobu |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Input - Native SDE Support | Version: | 4.10 |
Severity: | normal | Keywords: | sde querybyattribute |
Cc: | sdlime |
Description
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
Change History (4)
comment:1 by , 17 years ago
Keywords: | sde querybyattribute added |
---|
comment:2 by , 17 years ago
Component: | AGG → Input - Native SDE Support |
---|---|
Owner: | changed from | to
comment:3 by , 17 years ago
Cc: | added |
---|
comment:4 by , 17 years ago
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
Steve,
Did SDE ever do this before?
Howard