[mapserver-commits] r10531 - branches/branch-5-6/mapserver

svn at osgeo.org svn at osgeo.org
Tue Sep 28 16:51:34 EDT 2010


Author: aboudreault
Date: 2010-09-28 20:51:33 +0000 (Tue, 28 Sep 2010)
New Revision: 10531

Modified:
   branches/branch-5-6/mapserver/HISTORY.TXT
   branches/branch-5-6/mapserver/maporaclespatial.c
Log:
Backported in 5.6: Fixed Oracle Spatial Data gets corrupt (#3541)

Modified: branches/branch-5-6/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-6/mapserver/HISTORY.TXT	2010-09-28 19:23:07 UTC (rev 10530)
+++ branches/branch-5-6/mapserver/HISTORY.TXT	2010-09-28 20:51:33 UTC (rev 10531)
@@ -14,6 +14,8 @@
 Current Version
 ---------------
 
+- Fixed Oracle Spatial Data gets corrupt (#3541)
+
 - Fixed issue with multiple styles and binding (#3538)
 
 - Fixed multiple include tags not supported in xml mapfiles (#3530)

Modified: branches/branch-5-6/mapserver/maporaclespatial.c
===================================================================
--- branches/branch-5-6/mapserver/maporaclespatial.c	2010-09-28 19:23:07 UTC (rev 10530)
+++ branches/branch-5-6/mapserver/maporaclespatial.c	2010-09-28 20:51:33 UTC (rev 10531)
@@ -1895,6 +1895,7 @@
     int success, i;
     int function = 0;
     int version = 0;
+    int existunique = MS_FALSE;
     char query_str[6000];
     char *table_name;
     char geom_column_name[100], unique[100], srid[100];
@@ -1953,7 +1954,28 @@
     if (strcmp(srid,"NULL") == 0)
         strcpy(srid,"-1");
 
-    sprintf( query_str, "SELECT %s", unique );
+    /* Check if the unique field is already in the items list */
+    for( i=0; i < layer->numitems; ++i ) {
+        if (strcmp(unique, layer->items[i])==0) {
+            existunique = MS_TRUE;
+            break;
+        }
+    }
+        
+    if (existunique)
+    { 
+        if (strcasecmp(unique, "rownum") == 0) 
+            sprintf( query_str, "SELECT "); 
+        else 
+            sprintf( query_str, "SELECT %s, ", "rownum"); 
+    } 
+    else
+    { 
+        if (strcasecmp(unique, "rownum") == 0) 
+            sprintf( query_str, "SELECT %s,", unique ); 
+        else 
+            sprintf( query_str, "SELECT %s, %s,", "rownum", unique ); 
+    } 
 
     /* allocate enough space for items */
     if (layer->numitems >= 0)
@@ -1978,9 +2000,9 @@
 
     /* define SQL query */
     for( i=0; i < layer->numitems; ++i )
-        sprintf( query_str + strlen(query_str), ", %s", layer->items[i] );
+        sprintf( query_str + strlen(query_str), "%s, ", layer->items[i] );
 
-    sprintf( query_str + strlen(query_str), ", %s FROM %s", geom_column_name, table_name );
+    sprintf( query_str + strlen(query_str), "%s FROM %s", geom_column_name, table_name );
 
     osFilteritem(layer, function, query_str, 1);
 



More information about the mapserver-commits mailing list