[Mono-dev] RE: [Mono-patches] r57149 - in trunk/mcs/class/System.Data: System.DataSystem.Data.Common Test/ProviderTests/System.Data.SqlClientTest/System.Data

Boris Kirzner borisk at mainsoft.com
Mon Mar 6 03:03:28 EST 2006


Hello Senga,

One of your latest updates introduces a regression (see attached test
case, passes on r57148 but fails on r57149), due to the change in Key
default row state filter.

Please, next time you want to introduce some changes that has such a
wide effect, especially in the code you do not wrote by your own, maybe
it worth to give this fixes an opportunity to be reviewed by the
community before applying them.

Thanks,
Boris

--
Boris Kirzner
Mono R&D team, Mainsoft Corporation.
Blogging at http://boriskirzner.blogspot.com/  

> -----Original Message-----
> From: mono-patches-bounces at lists.ximian.com 
> [mailto:mono-patches-bounces at lists.ximian.com] On Behalf Of 
> senga (tsenganal at novell.com)
> Sent: Wednesday, February 22, 2006 12:03 PM
> To: mono-patches at lists.ximian.com; ximian.monolist at gmail.com; 
> mono-patches-list at googlegroups.com
> Subject: [Mono-patches] r57149 - in 
> trunk/mcs/class/System.Data: System.DataSystem.Data.Common 
> Test/ProviderTests/System.Data.SqlClientTest/System.Data
> 
> Author: senga
> Date: 2006-02-22 05:03:03 -0500 (Wed, 22 Feb 2006) New Revision: 57149
> 
> Modified:
>    trunk/mcs/class/System.Data/System.Data.Common/ChangeLog
>    trunk/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
>    trunk/mcs/class/System.Data/System.Data.Common/Key.cs
>    trunk/mcs/class/System.Data/System.Data/ChangeLog
>    trunk/mcs/class/System.Data/System.Data/DataRow.cs
>    
> trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.Sql
> Client/ChangeLog
>    
> trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.Sql
> Client/SqlDataAdapterTest.cs
>    trunk/mcs/class/System.Data/Test/System.Data/ChangeLog
>    
> trunk/mcs/class/System.Data/Test/System.Data/DataRowCollectionTest2.cs
>    trunk/mcs/class/System.Data/Test/System.Data/DataTableTest2.cs
>    
> trunk/mcs/class/System.Data/Test/System.Data/ForeignKeyConstra
> intTest.cs
> Log:
> 2006-02-22  Senganal T  <tsenganal at novell.com>
> 
> 	* Test/System.Data/DataRowCollectionTest2.cs : Check if 
> index is maintained for row on calling RejectChanges. 
> 	* Test/System.Data/DataTableTest2.cs : Check if data is 
> loaded and merged (if key exists) correctly.
> 	* Test/System.Data/ForeignKeyConstraintTest.cs : Check 
> if a ParentColumn value can be modified
> 		when the row is in 'Added' State. Also, check 
> if child col values are
> 		updated correctly.
> 	* 
> Test/ProviderTests/System.Data.SqlClient/SqlAdapterTest.cs : 
> Added testcases for verifying FillError Behavior
> 	* System.Data.Common/DbDataAdapter.cs :
> 		- FillTable : Move BeginLoadData, EndLoadData 
> outside the loop. Also,
> 		move EndLoadData outsidet try,catch block. 
> FillError is only for errors
> 		occuring during loading the data into datatable.
> 	* System.Data.Common/Key.cs :
> 		- Set Default value of RowStateFilter to 
> (CurrentRos | OriginalRows).
> 		- ContainsVersion : If RowStateFilter is set to 
> default value, return true
> 		for Modified Rows as they can contain 
> Default/Original versions.
> 	* System.Data/DataRow.cs 
> 		- RejectChanges : Do not remove Row from 
> Indexes when state is Deleted.
> 		- CheckChildRows : When checking for the 
> ChildRows, use the current value
> 		and not the original value.
> 
> 
> 
> Modified: trunk/mcs/class/System.Data/System.Data/ChangeLog
> ===================================================================
> --- trunk/mcs/class/System.Data/System.Data/ChangeLog	
> 2006-02-22 09:35:09 UTC (rev 57148)
> +++ trunk/mcs/class/System.Data/System.Data/ChangeLog	
> 2006-02-22 10:03:03 UTC (rev 57149)
> @@ -1,3 +1,10 @@
> +2006-02-22  Senganal T  <tsenganal at novell.com>
> +
> +	* DataRow.cs 
> +		- RejectChanges : Do not remove Row from 
> Indexes when state is Deleted.
> +		- CheckChildRows : When checking for the 
> ChildRows, use the current value
> +		and not the original value.
> +
>  2006-02-18  Atsushi Enomoto  <atsushi at ximian.com>
>  
>  	* CustomDataClassGenerator.cs : Patch by Marek 
> Habersack. xsd now
> 
> Modified: trunk/mcs/class/System.Data/System.Data/DataRow.cs
> ===================================================================
> --- trunk/mcs/class/System.Data/System.Data/DataRow.cs	
> 2006-02-22 09:35:09 UTC (rev 57148)
> +++ trunk/mcs/class/System.Data/System.Data/DataRow.cs	
> 2006-02-22 10:03:03 UTC (rev 57149)
> @@ -591,14 +591,14 @@
>  					return;
>  			case DataRowState.Added:
>  			case DataRowState.Modified:
> -					int original = Original;
> -					DataRowState oldState = 
> RowState;
> +				int original = Original;
> +				DataRowState oldState = RowState;
>                                  if (Original >= 0) {
>                                          
> Table.RecordCache.DisposeRecord(Original);
>                                  }
>                                  Original = Current;
> -					foreach (Index index in 
> Table.Indexes)
> -						
> index.Update(this, original, DataRowVersion.Original, oldState);
> +				foreach (Index index in Table.Indexes)
> +					index.Update(this, 
> original, DataRowVersion.Original, oldState);
>  				break;
>  			case DataRowState.Deleted:
>  				Table.DeleteRowFromIndexes(this);
> @@ -654,7 +654,7 @@
>  				Proposed = -1;
>  
>  				foreach(Index index in Table.Indexes)
> -					
> index.Update(this,oldRecord, DataRowVersion.Proposed, 
> oldState);					
> +					
> index.Update(this,oldRecord, DataRowVersion.Proposed, oldState);
>  			}
>  		}
>  
> @@ -695,9 +695,8 @@
>  			if (Current >= 0) {
>  				int current = Current;
>  				DataRowState oldState = RowState;
> -				if (Current != Original) {
> +				if (Current != Original)
>  					
> _table.RecordCache.DisposeRecord(Current);
> -				}
>  				Current = -1;
>  				foreach(Index index in Table.Indexes)
>  					index.Update(this, 
> current, DataRowVersion.Current, oldState); @@ -769,7 +768,7 @@
>  								
> // change only the values in the key columns
>  								
> // set the childcolumn value to the new parent row value
>  								
> 	for (int k = 0; k < fkc.Columns.Length; k++)
> -								
> 		if (!fkc.RelatedColumns [k].DataContainer 
> [Original].Equals (fkc.RelatedColumns [k].DataContainer [Proposed]))
> +								
> 		if (!fkc.RelatedColumns [k].DataContainer 
> [Current].Equals 
> +(fkc.RelatedColumns [k].DataContainer [Proposed]))
>  								
> 			childRows[j][fkc.Columns[k]] = 
> this[fkc.RelatedColumns[k], DataRowVersion.Proposed];
>  
>  								
> 	break;
> @@ -1340,7 +1339,6 @@
>  				break;
>  			case DataRowState.Deleted:
>  				CheckChildRows (DataRowAction.Rollback);
> -				Table.DeleteRowFromIndexes(this);
>  				Current = Original;
>  				break;
>  			}
> 
> Modified: trunk/mcs/class/System.Data/System.Data.Common/ChangeLog
> ===================================================================
> --- trunk/mcs/class/System.Data/System.Data.Common/ChangeLog	
> 2006-02-22 09:35:09 UTC (rev 57148)
> +++ trunk/mcs/class/System.Data/System.Data.Common/ChangeLog	
> 2006-02-22 10:03:03 UTC (rev 57149)
> @@ -1,3 +1,14 @@
> +2006-02-22  Senganal T <tsenganal at novell.com>
> +
> +	* DbDataAdapter.cs :
> +		- FillTable : Move BeginLoadData, EndLoadData 
> outside the loop. Also,
> +		move EndLoadData outsidet try,catch block. 
> FillError is only for errors
> +		occuring during loading the data into datatable.
> +	* Key.cs :
> +		- Set Default value of RowStateFilter to 
> (CurrentRos | OriginalRows).
> +		- ContainsVersion : If RowStateFilter is set to 
> default value, return true
> +		for Modified Rows as they can contain 
> Default/Original versions.
> +
>  2006-02-18  Raja R Harinath  <harinath at gmail.com>
>  
>  	* DbConnectionStringBuilder.cs (ICollection.CopyTo): Use
> 
> Modified: 
> trunk/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
> ===================================================================
> --- 
> trunk/mcs/class/System.Data/System.Data.Common/DbDataAda
> pter.cs	2006-02-22 09:35:09 UTC (rev 57148)
> +++ 
> trunk/mcs/class/System.Data/System.Data.Common/DbDataAda
> pter.cs	2006-02-22 10:03:03 UTC (rev 57149)
> @@ -408,13 +408,12 @@
>  				dataReader.Read ();
>  			}
>  
> +			dataTable.BeginLoadData ();
>  			while (dataReader.Read () && 
> (maxRecords == 0 || (counter - counterStart) < maxRecords)) {
>  				try {
> -					dataTable.BeginLoadData ();
>  					dataTable.LoadDataRow 
> (dataReader, sortedMapping, length, AcceptChangesDuringFill);
> -					dataTable.EndLoadData ();
>  					counter++;
> -				} 
> +				}
>  				catch (Exception e) {
>  					object[] readerArray = 
> new object[dataReader.FieldCount];
>  					object[] tableArray = 
> new object[mapping.Length]; @@ -428,20 +427,22 @@
>  					}
>  					FillErrorEventArgs args 
> = CreateFillErrorEvent (dataTable, tableArray, e);
>  					OnFillError (args);
> -					if(!args.Continue) {
> -						return false;
> -					}
> +
> +					// if args.Continue is 
> not set to true or if a handler is not set, rethrow the error..
> +					if(!args.Continue)
> +						throw e;
>  				}
>  			}
> +			dataTable.EndLoadData ();
>  			return true;
>  		}
>  
>  #if NET_2_0
> -                /// <summary>
> -                ///     Fills the given datatable using 
> values from reader. if a value 
> -                ///     for a column is  null, that will be 
> filled with default value. 
> -                /// </summary>
> -                /// <returns>No. of rows affected </returns>
> +		/// <summary>
> +		///     Fills the given datatable using values 
> from reader. if a value 
> +		///     for a column is  null, that will be 
> filled with default value. 
> +		/// </summary>
> +		/// <returns>No. of rows affected </returns>
>  		internal static int FillFromReader (DataTable table,
>                                                      
> IDataReader reader,
>                                                      int start, 
> 
> Modified: trunk/mcs/class/System.Data/System.Data.Common/Key.cs
> ===================================================================
> --- trunk/mcs/class/System.Data/System.Data.Common/Key.cs	
> 2006-02-22 09:35:09 UTC (rev 57148)
> +++ trunk/mcs/class/System.Data/System.Data.Common/Key.cs	
> 2006-02-22 10:03:03 UTC (rev 57149)
> @@ -47,6 +47,7 @@
>  		//	and always uses the _current version
>  		//so need a temp row for Eval calls
>  		DataRow _tmpRow;
> +		static DataViewRowState DefaultRowStateFilter = 
> +(DataViewRowState.CurrentRows | DataViewRowState.OriginalRows);
>  
>  		#endregion //Fields
>  
> @@ -69,13 +70,11 @@
>  				}
>  			}
>  
> -			if (rowState != DataViewRowState.None) {
> +			if (rowState != DataViewRowState.None)
>  				_rowStateFilter = rowState;
> -			}
> -			else {
> +			else
>  				// FIXME : what is the correct value ?
> -				_rowStateFilter = 
> DataViewRowState.CurrentRows;
> -			}
> +				_rowStateFilter = DefaultRowStateFilter;
>  		}
>  
>  		#endregion // Constructors
> @@ -166,77 +165,59 @@
>  		internal bool ContainsVersion (DataRowState 
> state, DataRowVersion version)
>  		{
>  			switch (state) {
> -				case DataRowState.Unchanged: {
> -					if ((_rowStateFilter & 
> DataViewRowState.Unchanged) != DataViewRowState.None) {
> +				case DataRowState.Unchanged:
> +					if ((_rowStateFilter & 
> DataViewRowState.Unchanged) != 
> +DataViewRowState.None)
>  						return 
> ((version & DataRowVersion.Default) != 0);
> -					}
> -
>  					break;
> -				}
> -				case DataRowState.Added: {
> -					if ((_rowStateFilter & 
> DataViewRowState.Added) != DataViewRowState.None) {
> +				case DataRowState.Added:
> +					if ((_rowStateFilter & 
> DataViewRowState.Added) != 
> +DataViewRowState.None)
>  						return 
> ((version & DataRowVersion.Default) != 0);
> -					}
> -
>  					break;
> -				}
> -				case DataRowState.Deleted: {
> -					if ((_rowStateFilter & 
> DataViewRowState.Deleted) != DataViewRowState.None) {
> +				case DataRowState.Deleted:
> +					if ((_rowStateFilter & 
> DataViewRowState.Deleted) != 
> +DataViewRowState.None)
>  						return (version 
> == DataRowVersion.Original);
> -					}
> -
>  					break;
> -				}
>  				default:
> -					if ((_rowStateFilter & 
> DataViewRowState.ModifiedCurrent) != DataViewRowState.None) {
> +					// If _rowStateFilter 
> has the default value, return true
> +					if (_rowStateFilter ==  
> DefaultRowStateFilter)
> +						return true;
> +					if ((_rowStateFilter & 
> DataViewRowState.ModifiedCurrent) != 
> +DataViewRowState.None)
>  						return 
> ((version & DataRowVersion.Default) != 0);
> -					}
> -					else if 
> ((_rowStateFilter & DataViewRowState.ModifiedOriginal) != 
> DataViewRowState.None) {
> +					if ((_rowStateFilter & 
> DataViewRowState.ModifiedOriginal) != 
> +DataViewRowState.None)
>  						return (version 
> == DataRowVersion.Original);
> -					}
> -
>  					break;
>  			}
>  
> -            return false;
> +			return false;
>  		}
>  
>  		internal static int GetRecord(DataRow row, 
> DataViewRowState rowStateFilter)
>  		{
>  			switch (row.RowState) {
>  				case DataRowState.Unchanged: {
> -					if ((rowStateFilter & 
> DataViewRowState.Unchanged) != DataViewRowState.None) {
> +					if ((rowStateFilter & 
> DataViewRowState.Unchanged) != 
> +DataViewRowState.None)
>  						return 
> row.Proposed >= 0 ? row.Proposed : row.Current;
> -					}
> -
>  					break;
>  				}
>  				case DataRowState.Added: {
> -					if ((rowStateFilter & 
> DataViewRowState.Added) != DataViewRowState.None) {
> +					if ((rowStateFilter & 
> DataViewRowState.Added) != 
> +DataViewRowState.None)
>  						return 
> row.Proposed >= 0 ? row.Proposed : row.Current;
> -					}
> -
>  					break;
>  				}
>  				case DataRowState.Deleted: {
> -					if ((rowStateFilter & 
> DataViewRowState.Deleted) != DataViewRowState.None) {
> +					if ((rowStateFilter & 
> DataViewRowState.Deleted) != 
> +DataViewRowState.None)
>  						return row.Original;
> -					}
> -
>  					break;
>  				}
>  				default:
> -					if ((rowStateFilter & 
> DataViewRowState.ModifiedCurrent) != DataViewRowState.None) {
> +					if ((rowStateFilter & 
> DataViewRowState.ModifiedCurrent) != 
> +DataViewRowState.None)
>  						return 
> row.Proposed >= 0 ? row.Proposed : row.Current;
> -					}
> -					else if 
> ((rowStateFilter & DataViewRowState.ModifiedOriginal) != 
> DataViewRowState.None) {
> +					if ((rowStateFilter & 
> DataViewRowState.ModifiedOriginal) != 
> +DataViewRowState.None)
>  						return row.Original;
> -					}
> -
>  					break;
>  			}
>  
> -            return -1;
> +			return -1;
>  		}
>  
>  		/// <summary>
> 
> Modified: 
> trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.Sql
> Client/ChangeLog
> ===================================================================
> --- 
> trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.Sql
> Client/ChangeLog	2006-02-22 09:35:09 UTC (rev 57148)
> +++ 
> trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.Sql
> Client/ChangeLog	2006-02-22 10:03:03 UTC (rev 57149)
> @@ -1,5 +1,9 @@
>  2006-02-13  Senganal T  <tsenganal at novell.com>
>  
> +	* SqlAdapterTest.cs : Added testcases for verifying 
> FillError Behavior
> +
> +2006-02-13  Senganal T  <tsenganal at novell.com>
> +
>  	* SqlAdapterTest.cs : Added testcases for #77480
>  
>  2006-02-10  Senganal T  <tsenganal at novell.com>
> 
> Modified: 
> trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.Sql
> Client/SqlDataAdapterTest.cs
> ===================================================================
> --- 
> trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.Sql
> Client/SqlDataAdapterTest.cs	2006-02-22 09:35:09 UTC (rev 57148)
> +++ 
> trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.Sql
> Client/SqlDataAdapterTest.cs	2006-02-22 10:03:03 UTC (rev 57149)
> @@ -388,7 +388,52 @@
>  			}
>  		}
>  
> +		bool FillErrorContinue = false;
>  		[Test]
> +		public void Fill_Test_FillErrorTest ()
> +		{
> +			string query = "select type_bigint from 
> numeric_family where id=1 or 
> +id=4 ";
> +
> +			DataSet ds = new DataSet ();
> +			DataTable table = ds.Tables.Add ("test");
> +			table.Columns.Add ("col", typeof (int));
> +
> +			adapter = new SqlDataAdapter (query, 
> connectionString);
> +			DataTableMapping mapping = 
> adapter.TableMappings.Add ("numeric_family", "test");
> +			mapping.ColumnMappings.Add 
> ("type_bigint", "col");
> +
> +			int count = 0;
> +			try {
> +				count = adapter.Fill (ds, 
> "numeric_family");
> +				Assert.Fail ("#1 Overflow 
> exception must be thrown");
> +			}catch (OverflowException e) {
> +			}
> +			Assert.AreEqual (0, ds.Tables 
> [0].Rows.Count, "#2");
> +			Assert.AreEqual (0, count, "#3");
> +
> +			adapter.FillError += new 
> FillErrorEventHandler (ErrorHandler);
> +			FillErrorContinue = false;
> +			try {
> +				count = adapter.Fill (ds, 
> "numeric_family");
> +				Assert.Fail ("#4 Overflow 
> exception must be thrown");
> +			}catch (OverflowException e) {
> +			}
> +			Assert.AreEqual (0, ds.Tables 
> [0].Rows.Count, "#5");
> +			Assert.AreEqual (0, count, "#6");
> +
> +			FillErrorContinue = true;
> +			count = adapter.Fill (ds, "numeric_family");
> +			// 1 row shud be filled
> +			Assert.AreEqual (1, ds.Tables 
> [0].Rows.Count, "#7");
> +			Assert.AreEqual (1, count, "#8");
> +		}
> +
> +		void ErrorHandler (object sender, 
> FillErrorEventArgs args)
> +		{
> +			args.Continue = FillErrorContinue;
> +		}
> +
> +		[Test]
>  		public void GetFillParametersTest ()
>  		{
>  			string query = "select id, type_bit 
> from numeric_family where id > @param1";
> 
> Modified: trunk/mcs/class/System.Data/Test/System.Data/ChangeLog
> ===================================================================
> --- trunk/mcs/class/System.Data/Test/System.Data/ChangeLog	
> 2006-02-22 09:35:09 UTC (rev 57148)
> +++ trunk/mcs/class/System.Data/Test/System.Data/ChangeLog	
> 2006-02-22 10:03:03 UTC (rev 57149)
> @@ -1,3 +1,11 @@
> +2006-02-22  Senganal T  <tsenganal at novell.com>
> +
> +	* DataRowCollectionTest2.cs : Check if index is 
> maintained for row on calling RejectChanges. 
> +	* DataTableTest2.cs : Check if data is loaded and 
> merged (if key exists) correctly.
> +	* ForeignKeyConstraintTest.cs : Check if a ParentColumn 
> value can be modified
> +		when the row is in 'Added' State. Also, check 
> if child col values are
> +		updated correctly.
> +
>  2006-02-16  Senganal T  <tsenganal at novell.com>
>  
>  	* DataSetTest2.cs :
> 
> Modified: 
> trunk/mcs/class/System.Data/Test/System.Data/DataRowCollectionTest2.cs
> ===================================================================
> --- 
> trunk/mcs/class/System.Data/Test/System.Data/DataRowCollection
> Test2.cs	2006-02-22 09:35:09 UTC (rev 57148)
> +++ 
> trunk/mcs/class/System.Data/Test/System.Data/DataRowCollection
> Test2.cs	2006-02-22 10:03:03 UTC (rev 57149)
> @@ -183,6 +183,22 @@
>  			dt.Rows.Add((Object[])null);
>  		}
>  
> +		[Test]
> +		public void FindByKey ()
> +		{
> +			DataTable table = new DataTable ();
> +			table.Columns.Add ("col1", typeof (int));
> +			table.PrimaryKey = new DataColumn[] 
> {table.Columns [0]};
> +
> +			table.Rows.Add (new object[] {1});
> +			table.AcceptChanges ();
> +			Assert.IsNotNull (table.Rows.Find (new 
> object[] {1}), "#1");
> +
> +			table.Rows[0].Delete ();
> +			table.RejectChanges ();
> +			Assert.IsNotNull (table.Rows.Find (new 
> object[] {1}), "#2");
> +		}
> +
>  		[Test]
>  		public void DataRowCollection_Clear1()
>  		{
> 
> Modified: 
> trunk/mcs/class/System.Data/Test/System.Data/DataTableTest2.cs
> ===================================================================
> --- 
> trunk/mcs/class/System.Data/Test/System.Data/DataTableT
> est2.cs	2006-02-22 09:35:09 UTC (rev 57148)
> +++ 
> trunk/mcs/class/System.Data/Test/System.Data/DataTableT
> est2.cs	2006-02-22 10:03:03 UTC (rev 57149)
> @@ -1949,6 +1949,44 @@
>  			Assert.AreEqual (1, 
> table.Constraints.Count, "#1");
>  		}
>  
> +		[Test]
> +		public void LoadDataRow_ExistingData ()
> +		{
> +			DataSet ds = new DataSet ();
> +			DataTable table = ds.Tables.Add ();
> +			
> +			table.Columns.Add ("col1", typeof (int));
> +			table.Columns.Add ("col2", typeof (int));
> +			table.PrimaryKey = new DataColumn[] 
> {table.Columns [0]};
> +
> +			table.BeginLoadData ();
> +			table.LoadDataRow (new object[] {1,10}, true);
> +			table.LoadDataRow (new object[] {2,10}, true);
> +			table.LoadDataRow (new object[] {3,10}, true);
> +			table.LoadDataRow (new object[] {4,10}, true);
> +			table.EndLoadData ();
> +
> +			Assert.AreEqual (4, table.Rows.Count, "#1");
> +			Assert.AreEqual (10, table.Rows [0][1], "#2");
> +			Assert.AreEqual (10, table.Rows [1][1], "#3");
> +			Assert.AreEqual (10, table.Rows [2][1], "#4");
> +			Assert.AreEqual (10, table.Rows [3][1], "#5");
> +	
> +
> +			table.BeginLoadData ();
> +			table.LoadDataRow (new object[] {1,100}, true);
> +			table.LoadDataRow (new object[] {2,100}, true);
> +			table.LoadDataRow (new object[] {3,100}, true);
> +			table.LoadDataRow (new object[] {4,100}, true);
> +			table.EndLoadData ();
> +
> +			Assert.AreEqual (4, table.Rows.Count, "#6");
> +			Assert.AreEqual (100, table.Rows [0][1], "#7");
> +			Assert.AreEqual (100, table.Rows [1][1], "#8");
> +			Assert.AreEqual (100, table.Rows [2][1], "#7");
> +			Assert.AreEqual (100, table.Rows [3][1], "#10");
> +		}
> +
>  		private void OnRowDeleting_Handler(Object 
> sender,DataRowChangeEventArgs e)
>  		{
>  			
> 
> Modified: 
> trunk/mcs/class/System.Data/Test/System.Data/ForeignKeyConstra
> intTest.cs
> ===================================================================
> --- 
> trunk/mcs/class/System.Data/Test/System.Data/ForeignKeyConstra
> intTest.cs	2006-02-22 09:35:09 UTC (rev 57148)
> +++ 
> trunk/mcs/class/System.Data/Test/System.Data/ForeignKeyConstra
> intTest.cs	2006-02-22 10:03:03 UTC (rev 57149)
> @@ -509,5 +509,22 @@
>  				_ds.EnforceConstraints = true;
>  			}
>  		}
> +
> +		[Test]
> +		public void ModifyParentKeyBeforeAcceptChanges ()
> +		{
> +			DataSet ds1 = new DataSet();
> +			DataTable t1= ds1.Tables.Add ("t1");
> +			DataTable t2= ds1.Tables.Add ("t2");
> +			t1.Columns.Add ("col1", typeof (int));
> +			t2.Columns.Add ("col2", typeof (int));
> +			ds1.Relations.Add ("fk", t1.Columns 
> [0], t2.Columns [0]);
> +
> +			t1.Rows.Add (new object[] {10});
> +			t2.Rows.Add (new object [] {10});
> +
> +			t1.Rows [0][0]=20;
> +			Assert("#1", (int)t2.Rows [0][0] == 20);
> +		}
>  	}
>  }
> 
> _______________________________________________
> Mono-patches maillist  -  Mono-patches at lists.ximian.com 
> http://lists.ximian.com/mailman/listinfo/mono-patches
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Class2.cs
Type: application/octet-stream
Size: 731 bytes
Desc: Class2.cs
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060306/09efca47/attachment.obj 


More information about the Mono-devel-list mailing list