Author: anagappan
Date: 2007-02-23 01:59:13 -0500 (Fri, 23 Feb 2007)
New Revision: 73353

Modified:
   trunk/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog
   trunk/mcs/class/System.Data/Mono.Data.SqlExpressions/Comparison.cs
Log:
2007-02-23  Nagappan A  <[EMAIL PROTECTED]>

        * Comparison.cs (Compare): Extra space characters issue when using
        System.Data.DataTable.Select. Fixes bug # 79695.



Modified: trunk/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog      
2007-02-23 06:52:30 UTC (rev 73352)
+++ trunk/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog      
2007-02-23 06:59:13 UTC (rev 73353)
@@ -1,3 +1,8 @@
+2007-02-23  Nagappan A  <[EMAIL PROTECTED]>
+
+       * Comparison.cs (Compare): Extra space characters issue when using
+       System.Data.DataTable.Select. Fixes bug # 79695.
+
 2006-12-07  Nagappan A  <[EMAIL PROTECTED]>
 
        * Parser.jay (ColumnName): Fix Invalid DataColumn Expression, bug

Modified: trunk/mcs/class/System.Data/Mono.Data.SqlExpressions/Comparison.cs
===================================================================
--- trunk/mcs/class/System.Data/Mono.Data.SqlExpressions/Comparison.cs  
2007-02-23 06:52:30 UTC (rev 73352)
+++ trunk/mcs/class/System.Data/Mono.Data.SqlExpressions/Comparison.cs  
2007-02-23 06:59:13 UTC (rev 73353)
@@ -66,6 +66,9 @@
                        
                }
                        
+               // certain trailing whitespace chars (including space) are 
ignored by .NET when comparing strings. See bug #79695.  
+               private static readonly char[] IgnoredTrailingChars = { (char) 
0x20, (char) 0x3000, (char) 0xFEFF };
+
                internal static int Compare (IComparable o1, IComparable o2, 
bool caseSensitive)
                {
                        //TODO: turn this "conversion pipeline" into something 
nicer
@@ -83,9 +86,13 @@
                                throw new EvaluateException (String.Format 
("Cannot perform compare operation on {0} and {1}.", o1.GetType(), 
o2.GetType()));
                        }
 
-                       if (o1 is string && o2 is string && !caseSensitive) {
-                               o1 = ((string)o1).ToLower();
-                               o2 = ((string)o2).ToLower();
+                       if (o1 is string && o2 is string) {
+                               o1 = ((string) o1).TrimEnd 
(IgnoredTrailingChars);
+                               o2 = ((string) o2).TrimEnd 
(IgnoredTrailingChars);
+                               if (!caseSensitive) {
+                                       o1 = ((string) o1).ToLower ();
+                                       o2 = ((string) o2).ToLower ();
+                               }
                        }
                        
                        if (o1.GetType () != o2.GetType ())

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

Reply via email to