[mapserver-commits] r9616 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Dec 15 13:48:55 EST 2009


Author: aboudreault
Date: 2009-12-15 13:48:55 -0500 (Tue, 15 Dec 2009)
New Revision: 9616

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/maporaclespatial.c
Log:
Oracle driver: remove BLOB columns instead of changing them to null (#3228)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-12-11 18:33:39 UTC (rev 9615)
+++ trunk/mapserver/HISTORY.TXT	2009-12-15 18:48:55 UTC (rev 9616)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Oracle driver: remove BLOB columns instead of changing them to null (#3228)
+
 - Fixed ogc sld functions to return proper values (#2165)
 
 - MAP EXTENT truncates GetFeature requests for data outside bounds (#1287)

Modified: trunk/mapserver/maporaclespatial.c
===================================================================
--- trunk/mapserver/maporaclespatial.c	2009-12-11 18:33:39 UTC (rev 9615)
+++ trunk/mapserver/maporaclespatial.c	2009-12-15 18:48:55 UTC (rev 9616)
@@ -1918,6 +1918,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];
@@ -1976,7 +1977,18 @@
     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)
+        sprintf( query_str, "SELECT");
+    else
+        sprintf( query_str, "SELECT %s", unique );
 
     /* allocate enough space for items */
     if (layer->numitems >= 0)
@@ -2508,24 +2520,21 @@
         /*Comapre the column name (flk) with geom_column_name and ignore with true*/
         if (strcmp(flk, geom_column_name) != 0)
         {	
-            layer->items[count_item] = (char *)malloc(sizeof(char) * flk_len+1);
-            if (layer->items[count_item] == NULL)
+            if (rzttype!=OCI_TYPECODE_BLOB) 
             {
-                msSetError( MS_ORACLESPATIALERR, "No memory avaliable to allocate the items buffer", "msOracleSpatialLayerGetItems()" );
-                free(table_name);
-                return MS_FAILURE;
+                layer->items[count_item] = (char *)malloc(sizeof(char) * flk_len+1);
+                if (layer->items[count_item] == NULL)
+                {
+                    msSetError( MS_ORACLESPATIALERR, "No memory avaliable to allocate the items buffer", "msOracleSpatialLayerGetItems()" );
+                    free(table_name);
+                    return MS_FAILURE;
+                }
+                
+                strcpy(layer->items[count_item], flk); 
+                count_item++;
             }
             else
-            {
-              if (rzttype!=OCI_TYPECODE_BLOB) 
-               {
-               	 strcpy(layer->items[count_item], flk); 
-               }
-               else{
-               	 strcpy(layer->items[count_item], "null");
-               }	         	 
-            }
-            count_item++;
+                layer->numitems--;
         }
         else
             existgeom = 1;



More information about the mapserver-commits mailing list