Author: kostat
Date: 2006-11-15 02:39:33 -0500 (Wed, 15 Nov 2006)
New Revision: 67889

Modified:
   trunk/mcs/class/System.Data/System.Data/ChangeLog
   trunk/mcs/class/System.Data/System.Data/DataRowCollection.cs
   trunk/mcs/class/System.Data/System.Data/DataTable.cs
   trunk/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
Log:
* DataTable.cs: Fixed LoadDataRow scenarios.
* DataRowCollection.cs: Added override for AddInternal taking DataRowAction 
parameter.


Modified: trunk/mcs/class/System.Data/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data/ChangeLog   2006-11-15 07:32:07 UTC 
(rev 67888)
+++ trunk/mcs/class/System.Data/System.Data/ChangeLog   2006-11-15 07:39:33 UTC 
(rev 67889)
@@ -1,5 +1,10 @@
-2006-11-24  Konstantin Triger <[EMAIL PROTECTED]>
+2006-11-15  Konstantin Triger <[EMAIL PROTECTED]>
 
+       * DataTable.cs: Fixed LoadDataRow scenarios.
+       * DataRowCollection.cs: Added override for AddInternal taking 
DataRowAction parameter.
+
+2006-11-14  Konstantin Triger <[EMAIL PROTECTED]>
+
        * DataColumn.cs: consider row version wen checking row.IsNull().
 
 2006-10-18  Nagappan A  <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/System.Data/System.Data/DataRowCollection.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataRowCollection.cs        
2006-11-15 07:32:07 UTC (rev 67888)
+++ trunk/mcs/class/System.Data/System.Data/DataRowCollection.cs        
2006-11-15 07:39:33 UTC (rev 67889)
@@ -109,14 +109,21 @@
                        AddInternal(row);
                }
 
-               internal void AddInternal(DataRow row) {
-                       row.Table.ChangingDataRow (row, DataRowAction.Add);
+               internal void AddInternal (DataRow row) {
+                       AddInternal (row, DataRowAction.Add);
+               }
+
+               internal void AddInternal(DataRow row, DataRowAction action) {
+                       row.Table.ChangingDataRow (row, action);
                        row.HasParentCollection = true;
                        List.Add (row);
                        // Set the row id.
                        row.RowID = List.Count - 1;
                        row.AttachRow ();
-                       row.Table.ChangedDataRow (row, DataRowAction.Add);
+                       if ((action & (DataRowAction.ChangeCurrentAndOriginal |
+                                                       
DataRowAction.ChangeOriginal)) != 0)
+                               row.Original = row.Current;
+                       row.Table.ChangedDataRow (row, action);
                        if (row._rowChanged)
                                row._rowChanged = false;
                }

Modified: trunk/mcs/class/System.Data/System.Data/DataTable.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataTable.cs        2006-11-15 
07:32:07 UTC (rev 67888)
+++ trunk/mcs/class/System.Data/System.Data/DataTable.cs        2006-11-15 
07:39:33 UTC (rev 67889)
@@ -1796,19 +1796,12 @@
                                      
                                 if (loadOption == LoadOption.OverwriteChanges 
||
                                     loadOption == LoadOption.PreserveChanges) {
-                                       Rows.AddInternal(row);
-                                       ChangingDataRow (row, 
DataRowAction.ChangeCurrentAndOriginal);
-                                       row.Original = row.Current;
-                                       ChangedDataRow (row, 
DataRowAction.ChangeCurrentAndOriginal);
+                                                                       
Rows.AddInternal (row, DataRowAction.ChangeCurrentAndOriginal);
                                 } else
                                        Rows.AddInternal(row);
                                 return row;
                         }
 
-                        if (row.RowState == DataRowState.Deleted 
-                           && loadOption == LoadOption.OverwriteChanges)
-                                row.RejectChanges ();                        
-
                         row.Load (values, loadOption);
 
                         return row;

Modified: trunk/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/DataTableTest.cs       
2006-11-15 07:32:07 UTC (rev 67888)
+++ trunk/mcs/class/System.Data/Test/System.Data/DataTableTest.cs       
2006-11-15 07:39:33 UTC (rev 67889)
@@ -1898,7 +1898,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void Load_RowStateChangesDefault () {
                        localSetup ();
                        dt.Rows.Add (new object[] { 4, "mono 4" });
@@ -1970,7 +1969,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void Load_RowStatePreserveChanges () {
                        localSetup ();
                        dt.Rows.Add (new object[] { 4, "mono 4" });
@@ -2042,7 +2040,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void Load_RowStateOverwriteChanges () {
                        localSetup ();
                        dt.Rows.Add (new object[] { 4, "mono 4" });
@@ -2097,7 +2094,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void Load_RowStateUpsert () {
                        localSetup ();
                        dt.Rows.Add (new object[] { 4, "mono 4" });

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

Reply via email to