I'm currently working on a web-project which consumes a map service vom ArcGIS-Server. This map service generates the layer dynamically from data in a oracle-database. From this layer the application generates a MapImage. The polygons, which are drawn on the layer, can have different colors and they should get z-order based on the color. This was achieved with a definition expression using some conditions and a "order by" statement when querying the MapImage.
This application originally ran with ArcGIS 10.0, got migrated to 10.1 and then got a upgrade to 10.2.2, here are the information about this progress related to the described proceedure:
The application used DCOM (what is deprecated now) and everything worked as expected.
I had to do very little changes in the code at this version upgrade for getting this working. But the query definition is now broken. Lets say the definition query I'm sending is something like "field > 0 AND user = 'someuserid' ORDER BY color". I've debugged the whole thing and I'm very sure that the query definition as described is send with no changes via SOAP. But the oracle database is receving a query with a where clause like this "(( field > 0 AND user = "someuserid" ORDER BY color ))". At this point the database of course returns a error. Oracle expects ' ' for string values (not " ") and also order by inside of ( ) is not accepted. If I'm removing the ORDER BY part everything works fine again (except the sorting in the MapImage). It also works fine when I'm using a definition expression which has a condition on the field which should be used vor the sorting like "field > 0 AND user = 'someuserid' AND color = 'blue'" (getting only the blue polygons).
First I thought this could be caused by the new standardized queries-flag, but setting this flag to false does not work for this problem.
As I see it the ArcGIS-Server somehow modifies the definition expresion for somewhat reason, even if he is told not to do so with the deactivated flag.
Does someone have a workaorund or solution for this problem (if anyone had this problem)?