[Mono-bugs] [Bug 73288][Nor] New - DataTable.ImportRow does not work on Mono 1.1.4
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 3 Mar 2005 11:25:50 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by dfreund@runlevel-5.org.
http://bugzilla.ximian.com/show_bug.cgi?id=73288
--- shadow/73288 2005-03-03 11:25:50.000000000 -0500
+++ shadow/73288.tmp.20164 2005-03-03 11:25:50.000000000 -0500
@@ -0,0 +1,185 @@
+Bug#: 73288
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dfreund@runlevel-5.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: DataTable.ImportRow does not work on Mono 1.1.4
+
+Description of Problem:
+DataTable.ImportRow only imports empty rows. This works ok on M$.NET
+and at least Mono 1.1.3
+I have experienced this problem on Mono 1.1.4 on SLES9 and Windows with
+original Mono 1.1.4-release and the Mono Snapshot from SVN which I got on
+2005-03-02
+
+
+Steps to reproduce the problem:
+0. Copy Main.cs, data.xml and schema.xsd to a directory of choice (TM)
+1. Compile the example Main.cs: mcs -r:System.Data Main.cs
+2. run it: mono Main.exe
+3. admire the empty table :-)
+
+Actual Results:
+The result-table consits of empty records
+
+Expected Results:
+The table should be filled with the original data like it does on M$.NET
+
+How often does this happen?
+Every time
+
+Additional Information:
+you may want to use the data.xml and schema.xsd from Bug
+http://bugzilla.ximian.com/show_bug.cgi?id=73020 where those 2 files are
+added as attachment
+
+Example Main.cs:
+================
+ using System;
+ using System.Data;
+
+ namespace DataTableTest
+ {
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ // create dataset and read from xml
+ DataSet ds = new DataSet();
+ ds.ReadXmlSchema("schema.xsd");
+ ds.ReadXml("data.xml");
+
+ // create a data table
+ DataTable data = ds.Tables["NAVI_NODE"];
+
+ // create second data table
+ DataTable tree = new DataTable("tree");
+ tree.Columns.Add("node_id", Type.GetType("System.Int32"));
+ tree.Columns.Add("parent_id", Type.GetType("System.Int32"));
+ tree.Columns.Add("z_order", Type.GetType("System.Int16"));
+ tree.Columns.Add("name", Type.GetType("System.String"));
+ tree.Columns.Add("frame", Type.GetType("System.String"));
+
+ // import all rows from "data" to "tree"
+ foreach (DataRow row in data.Rows)
+ {
+ // only import empty rows :(
+ tree.ImportRow(row);
+ }
+
+ // test output
+ string t = "";
+ foreach (DataColumn c in tree.Columns)
+ t += string.Format("{0,20} |", c.ColumnName);
+
+ Console.WriteLine(t);
+
+ // prints empty rows on mono 1.1.4. MS.NET and Mono 1.1.3
+ // are OK
+ foreach (DataRow r in tree.Rows)
+ {
+ t = "";
+ foreach (DataColumn c in tree.Columns)
+ t += string.Format("{0,20} |", r[c.ColumnName]);
+
+ Console.WriteLine(t);
+ }
+ }
+ }
+ }
+
+data.xml
+========
+ <?xml version="1.0" encoding="utf-8"?>
+ <USER_INFO xmlns:xs="http://www.w3.org/2001/XMLSchema"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <FST_NAME>Arthur</FST_NAME>
+ <LST_NAME>Dent</LST_NAME>
+ <NAVI_NODES>
+ <NAVI_NODE name="home" frame="welcome" z_order="6">3</NAVI_NODE>
+ <NAVI_NODE name="options" frame="none" z_order="7">85</NAVI_NODE>
+ <NAVI_NODE parent_id="3" name="list" frame="list"
+z_order="12">41</NAVI_NODE>
+ <NAVI_NODE parent_id="3" name="detail" frame="detail"
+z_order="14">82</NAVI_NODE>
+ <NAVI_NODE parent_id="85" name="prefs" frame="prefs"
+z_order="1">87</NAVI_NODE>
+ <NAVI_NODE parent_id="85" name="help" frame="help"
+z_order="2">89</NAVI_NODE>
+ </NAVI_NODES>
+ </USER_INFO>
+
+schema.xsd
+==========
+ <?xml version="1.0" encoding="UTF-8"?>
+ <xs:schema elementFormDefault="qualified"
+attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="USER_INFO">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="FST_NAME">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="30"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="LST_NAME">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="30"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="NAVI_NODES">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="NAVI_NODE" minOccurs="0"
+maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:positiveInteger">
+ <xs:attribute name="parent_id"
+type="xs:positiveInteger" use="optional"/>
+ <xs:attribute name="name" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="40"/>
+ <xs:minLength value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="frame" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="15"/>
+ <xs:minLength value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="z_order"
+type="xs:positiveInteger" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>