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

svn at osgeo.org svn at osgeo.org
Sat May 28 06:26:21 EDT 2011


Author: tamas
Date: 2011-05-28 03:26:21 -0700 (Sat, 28 May 2011)
New Revision: 11763

Modified:
   branches/branch-5-6/mapserver/HISTORY.TXT
   branches/branch-5-6/mapserver/mapmssql2008.c
Log:
Fixed mssql2008 to return correct geometries with chart layer type (#3894)

Modified: branches/branch-5-6/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-6/mapserver/HISTORY.TXT	2011-05-28 10:25:28 UTC (rev 11762)
+++ branches/branch-5-6/mapserver/HISTORY.TXT	2011-05-28 10:26:21 UTC (rev 11763)
@@ -14,6 +14,8 @@
 Version 5.6.7 (SVN branch-5-6):
 ---------------------------
 
+- Fixed mssql2008 to return correct geometries with chart layer type (#3894)
+
 - Fix segfault with png-inimage exceptions and quantize_force=on (#2903)
 
 - Fix segfault on malformed <PropertyIsLike> filters (#3888)

Modified: branches/branch-5-6/mapserver/mapmssql2008.c
===================================================================
--- branches/branch-5-6/mapserver/mapmssql2008.c	2011-05-28 10:25:28 UTC (rev 11762)
+++ branches/branch-5-6/mapserver/mapmssql2008.c	2011-05-28 10:26:21 UTC (rev 11763)
@@ -75,6 +75,7 @@
 
 #define SQL_COLUMN_NAME_MAX_LENGTH 128
 #define SQL_TABLE_NAME_MAX_LENGTH 128
+#define SQL_OID_SIZE 20
 
 #define DATA_ERROR_MESSAGE \
     "%s" \
@@ -573,7 +574,7 @@
     {
         char buffer[1000];
 
-        snprintf(buffer, sizeof(buffer), "%s.STAsBinary(),convert(varchar(36), %s)", layerinfo->geom_column, layerinfo->urid_name);
+        snprintf(buffer, sizeof(buffer), "%s.STAsBinary(),convert(varchar(%d), %s)", layerinfo->geom_column, SQL_OID_SIZE, layerinfo->urid_name);
 
         columns_wanted = _strdup(buffer);
     } 
@@ -585,7 +586,7 @@
             snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "convert(varchar(max), %s),", layer->items[t]);
         }
 
-        snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "%s.STAsBinary(),convert(varchar(36), %s)", layerinfo->geom_column, layerinfo->urid_name);
+        snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "%s.STAsBinary(),convert(varchar(%d), %s)", layerinfo->geom_column, SQL_OID_SIZE, layerinfo->urid_name);
 
         columns_wanted = _strdup(buffer);
     }
@@ -1246,7 +1247,7 @@
 	char dummyBuffer[1];
 	char *wkbBuffer;
 	char *valueBuffer;
-	char oidBuffer[ 16 ];		/* assuming the OID will always be a long this should be enough */
+	char oidBuffer[ SQL_OID_SIZE + 1 ];
     long record_oid;
 	int t;
 
@@ -1386,6 +1387,7 @@
 
                     case MS_LAYER_ANNOTATION:
                     case MS_LAYER_QUERY:
+                    case MS_LAYER_CHART:
                         result = dont_force(wkbBuffer, shape);
                         break;
 
@@ -1485,7 +1487,7 @@
 
     if(layer->numitems == 0) 
     {
-        snprintf(buffer, sizeof(buffer), "%s.STAsBinary(), convert(varchar(36), %s)", layerinfo->geom_column, layerinfo->urid_name);
+        snprintf(buffer, sizeof(buffer), "%s.STAsBinary(), convert(varchar(%d), %s)", layerinfo->geom_column, SQL_OID_SIZE, layerinfo->urid_name);
         columns_wanted = _strdup(buffer);
     } 
     else 
@@ -1494,7 +1496,7 @@
             snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "convert(varchar(max), %s),", layer->items[t]);
         }
 
-        snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "%s.STAsBinary(), convert(varchar(36), %s)", layerinfo->geom_column, layerinfo->urid_name);
+        snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "%s.STAsBinary(), convert(varchar(%d), %s)", layerinfo->geom_column, SQL_OID_SIZE, layerinfo->urid_name);
 
         columns_wanted = _strdup(buffer);
     }



More information about the mapserver-commits mailing list