Permalink
Browse files

For data sources with inconsistent row numbers, queryByIndex should n…

…ot set a resultindex. #4926 #4076
  • Loading branch information...
mkofahl authored and tbonfort committed May 28, 2014
1 parent 6ae1e52 commit 500860a68004229ad772d1c08e184c6a4dbf97e7
Showing with 11 additions and 0 deletions.
  1. +11 −0 mapquery.c
View
@@ -527,6 +527,17 @@ int msQueryByIndex(mapObj *map)
return(MS_FAILURE);
}
+ /*
+ * The resultindex is used to retrieve a specific item from the result cache.
+ * Usually, the row number will be used as resultindex. But when working with
+ * databases and querying a single result, the row number is typically 0 and
+ * thus useless as the index in the result cache. See #4926 #4076. Only shape
+ * files are considered to have consistent row numbers.
+ */
+ if ( !(lp->connectiontype == MS_SHAPEFILE || lp->connectiontype == MS_TILED_SHAPEFILE) ) {
+ shape.resultindex = -1;
+ }
+
if (lp->minfeaturesize > 0)
minfeaturesize = Pix2LayerGeoref(map, lp, lp->minfeaturesize);

0 comments on commit 500860a

Please sign in to comment.