[Mono-list] [PATCH] This patch make DataColumnCollection indexer by name and the Hashtable of DataTableCollection to be non case sensitive

Carlos Guzmán Álvarez carlosga@telefonica.net
Thu, 21 Nov 2002 16:40:43 +0100


This is a multi-part message in MIME format.
--------------040902030704000500090109
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hello:

I send two patches for make DataColumnCollection indexer by name and the
Hashtable of DataTableCollection to be non case sensitive ( ths solution
of te hastable is a suggestion of Gonzalo).


I think that on DataColumnCollection can be other methods affected by te
same issue ( can be a good idea to use a Hastable like on
DataTableCollection ??? )





Best regards
Carlos Guzmán Álvarez
Vigo-Spain


--------------040902030704000500090109
Content-Type: text/plain;
 name="DataTableCollectionPatch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="DataTableCollectionPatch.txt"

Index: DataTableCollection.cs
===================================================================
RCS file: /mono/mcs/class/System.Data/System.Data/DataTableCollection.cs,v
retrieving revision 1.8
diff -u -r1.8 DataTableCollection.cs
--- DataTableCollection.cs	12 Nov 2002 01:41:04 -0000	1.8
+++ DataTableCollection.cs	21 Nov 2002 15:04:17 -0000
@@ -32,7 +32,7 @@
 			: base ()
 		{
 			this.dataSet = dataSet;
-			this.tables = new Hashtable ();
+			this.tables = new Hashtable (CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
 		}
 		
 		#endregion


--------------040902030704000500090109
Content-Type: text/plain;
 name="DataColumnCollectionPatch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="DataColumnCollectionPatch.txt"

Index: DataColumnCollection.cs
===================================================================
RCS file: /mono/mcs/class/System.Data/System.Data/DataColumnCollection.cs,v
retrieving revision 1.10
diff -u -r1.10 DataColumnCollection.cs
--- DataColumnCollection.cs	12 Nov 2002 01:41:04 -0000	1.10
+++ DataColumnCollection.cs	21 Nov 2002 15:36:03 -0000
@@ -56,7 +56,17 @@
 						return column;
 					}
 				}
-				return null;                
+				
+				// If no column found make a non case sensitive search of the column name
+				foreach (DataColumn column in base.List)
+				{
+					if (column.ColumnName.ToUpper() == name.ToUpper())
+					{
+						return column;
+					}
+				}
+
+				return null;
 			}
 		}
 

--------------040902030704000500090109--