[mapguide-commits] r6752 - branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/SchemaOverrides

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jun 11 19:12:46 PDT 2012


Author: jng
Date: 2012-06-11 19:12:46 -0700 (Mon, 11 Jun 2012)
New Revision: 6752

Modified:
   branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcTableItem.cs
Log:
#1980: Backport ODBC configuration fix to 4.0.x

Modified: branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcTableItem.cs
===================================================================
--- branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcTableItem.cs	2012-06-11 14:30:25 UTC (rev 6751)
+++ branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcTableItem.cs	2012-06-12 02:12:46 UTC (rev 6752)
@@ -76,44 +76,43 @@
                 {
                     var table = doc.CreateElement("Table");
                     table.SetAttribute("name", this.ClassName);
+                    ctype.AppendChild(table);
+
+                    PropertyDefinition geomProp = null;
+                    foreach (var prop in cls.Properties)
                     {
-                        PropertyDefinition geomProp = null;
-                        foreach (var prop in cls.Properties)
+                        //If this is geometry, we'll handle it later
+                        if (prop.Name == cls.DefaultGeometryPropertyName)
                         {
-                            //If this is geometry, we'll handle it later
-                            if (prop.Name == cls.DefaultGeometryPropertyName)
-                            {
-                                geomProp = prop;
-                                continue;
-                            }
+                            geomProp = prop;
+                            continue;
+                        }
 
-                            var el = doc.CreateElement("element");
-                            el.SetAttribute("name", Utility.EncodeFDOName(prop.Name));
+                        var el = doc.CreateElement("element");
+                        el.SetAttribute("name", Utility.EncodeFDOName(prop.Name));
 
-                            var col = doc.CreateElement("Column");
-                            col.SetAttribute("name", prop.Name);
+                        var col = doc.CreateElement("Column");
+                        col.SetAttribute("name", prop.Name);
 
-                            el.AppendChild(col);
-                            table.AppendChild(el);
-                        }
+                        el.AppendChild(col);
+                        ctype.AppendChild(el);
+                    }
 
-                        //Append geometry mapping
-                        if (geomProp != null)
-                        {
-                            var el = doc.CreateElement("element");
-                            el.SetAttribute("name", geomProp.Name);
+                    //Append geometry mapping
+                    if (geomProp != null)
+                    {
+                        var el = doc.CreateElement("element");
+                        el.SetAttribute("name", geomProp.Name);
 
-                            if (!string.IsNullOrEmpty(this.XColumn))
-                                el.SetAttribute("xColumnName", this.XColumn);
-                            if (!string.IsNullOrEmpty(this.YColumn))
-                                el.SetAttribute("yColumnName", this.YColumn);
-                            if (!string.IsNullOrEmpty(this.ZColumn))
-                                el.SetAttribute("zColumnName", this.ZColumn);
+                        if (!string.IsNullOrEmpty(this.XColumn))
+                            el.SetAttribute("xColumnName", this.XColumn);
+                        if (!string.IsNullOrEmpty(this.YColumn))
+                            el.SetAttribute("yColumnName", this.YColumn);
+                        if (!string.IsNullOrEmpty(this.ZColumn))
+                            el.SetAttribute("zColumnName", this.ZColumn);
 
-                            table.AppendChild(el);
-                        }
+                        ctype.AppendChild(el);
                     }
-                    ctype.AppendChild(table);
                 }
                 currentNode.AppendChild(ctype);
             }
@@ -144,7 +143,9 @@
 
             var table = node["Table"];
 
-            foreach (System.Xml.XmlNode el in table.ChildNodes)
+            var el = table.NextSibling;
+            //foreach (System.Xml.XmlNode el in table.ChildNodes)
+            while(el != null)
             {
                 var colName = el.Attributes["name"];
 
@@ -161,6 +162,7 @@
                     if (z != null)
                         this.ZColumn = z.Value;
                 }
+                el = el.NextSibling;
             }
         }
     }



More information about the mapguide-commits mailing list