Author: atsushi
Date: 2005-02-25 05:06:19 -0500 (Fri, 25 Feb 2005)
New Revision: 41186

Modified:
   trunk/mcs/class/System.Data/System.Data/ChangeLog
   trunk/mcs/class/System.Data/System.Data/DataColumn.cs
   trunk/mcs/class/System.Data/Test/System.Data/ChangeLog
   trunk/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
Log:
2005-02-25  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * DataColumn.cs : setting negative value on MaxLength of SimpleContent
          column is still valid.

        * DataColumnTest.cs : added testcase for setting negative value on
          DataColumn whose mapping is SimpleContent.



Modified: trunk/mcs/class/System.Data/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data/ChangeLog   2005-02-25 09:39:56 UTC 
(rev 41185)
+++ trunk/mcs/class/System.Data/System.Data/ChangeLog   2005-02-25 10:06:19 UTC 
(rev 41186)
@@ -1,3 +1,8 @@
+2005-02-25  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * DataColumn.cs : setting negative value on MaxLength of SimpleContent
+         column is still valid.
+
 2005-02-15  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * XmlSchemaWriter.cs : new file for outputting XmlSchema.

Modified: trunk/mcs/class/System.Data/System.Data/DataColumn.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataColumn.cs       2005-02-25 
09:39:56 UTC (rev 41185)
+++ trunk/mcs/class/System.Data/System.Data/DataColumn.cs       2005-02-25 
10:06:19 UTC (rev 41186)
@@ -481,7 +481,8 @@
                                return maxLength;
                        }
                        set {
-                               if (_columnMapping == MappingType.SimpleContent)
+                               if (value >= 0 &&
+                                       _columnMapping == 
MappingType.SimpleContent)
                                        throw new ArgumentException 
(String.Format ("Cannot set MaxLength property on '{0}' column which is mapped 
to SimpleContent.", ColumnName));
                                //only applies to string columns
                                maxLength = value;

Modified: trunk/mcs/class/System.Data/Test/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/ChangeLog      2005-02-25 
09:39:56 UTC (rev 41185)
+++ trunk/mcs/class/System.Data/Test/System.Data/ChangeLog      2005-02-25 
10:06:19 UTC (rev 41186)
@@ -1,3 +1,8 @@
+2005-02-25  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * DataColumnTest.cs : added testcase for setting negative value on
+         DataColumn whose mapping is SimpleContent.
+
 2005-02-15  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * DataSetAssertion.cs : don't exclude those attribute whose namespace

Modified: trunk/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs      
2005-02-25 09:39:56 UTC (rev 41185)
+++ trunk/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs      
2005-02-25 10:06:19 UTC (rev 41186)
@@ -553,8 +553,9 @@
 
                [Test]
                [ExpectedException (typeof (ArgumentException))]
-               public void SetMaxColumn ()
+               public void SetMaxLengthException ()
                {
+                       // Setting MaxLength on SimpleContent -> exception
                        DataSet ds = new DataSet("Example");
                        ds.Tables.Add("MyType");
                        ds.Tables["MyType"].Columns.Add(new DataColumn("Desc", 
@@ -563,6 +564,17 @@
                }
 
                [Test]
+               public void SetMaxLengthNegativeValue ()
+               {
+                       // however setting MaxLength on SimpleContent is OK
+                       DataSet ds = new DataSet ("Example");
+                       ds.Tables.Add ("MyType");
+                       ds.Tables ["MyType"].Columns.Add (
+                               new DataColumn ("Desc", typeof (string), "", 
MappingType.SimpleContent));
+                       ds.Tables ["MyType"].Columns ["Desc"].MaxLength = -1;
+               }
+
+               [Test]
                 public void AdditionToConstraintCollectionTest()
                 {
                         DataTable myTable = new DataTable("myTable");

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to