Просмотр исходного кода

2002-11-03 Ville Palo <[email protected]>

	* System.Data.SqlTypes/SqlBinary.cs: Finished and no errors generated
	by NUnitConsole_mono.exe

svn path=/trunk/mcs/; revision=8801
Ville Palo 23 лет назад
Родитель
Сommit
4bd205478d

+ 5 - 0
mcs/class/System.Data/ChangeLog

@@ -1,3 +1,8 @@
+2002-11-03  Ville Palo <[email protected]>
+
+	* System.Data.SqlTypes/SqlBinary.cs: Finished and no errors generated
+	by NUnitConsole_mono.exe
+	
 2002-11-03  Tim Coleman ([email protected])
 	* System.Data.SqlClient/SqlCommand.cs:
 		Use SET NO_BROWSETABLE ON when CommandBehavior is KeyInfo

+ 10 - 12
mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs

@@ -100,6 +100,8 @@ namespace System.Data.SqlTypes
 		{
 			if (!(value is SqlBinary))
 				return false;
+			else if (((SqlBinary)value).IsNull)
+				return false;
 			else
 				return (bool) (this == (SqlBinary)value);
 		}
@@ -157,12 +159,7 @@ namespace System.Data.SqlTypes
 
 		public override string ToString () 
 		{
-			string result = "";;
-			
-			foreach (char c in value)
-				result += c;
-			
-			return result;
+			return "SqlBinary(" + value.Length + ")";
 		}
 
 		#endregion
@@ -176,14 +173,15 @@ namespace System.Data.SqlTypes
 			int j = 0;
 			int i;
 
-			for (i = 0; i < x.Value.Length; i++)
+			for (i = 0; i < x.Value.Length; i++) 
 				b [i] = x.Value [i];
+			
 
-			for ( ; i < (x.Value.Length + y.Value.Length -1); i++) {
-				b [i] = y.Value [0];
+			for (; i < (x.Value.Length + y.Value.Length); i++) {
+				b [i] = y.Value [j];
 				j++;
 			}	
-
+			
 			return new SqlBinary (b);
 		}
 			
@@ -192,7 +190,7 @@ namespace System.Data.SqlTypes
 			if (x.IsNull || y.IsNull) 
 				return SqlBoolean.Null;
 			else
-				return x.Value.Equals (y.Value);
+				return new SqlBoolean (Compare (x, y) == 0);
 		}
 
 		public static SqlBoolean operator > (SqlBinary x, SqlBinary y) 
@@ -216,7 +214,7 @@ namespace System.Data.SqlTypes
 			if (x.IsNull || y.IsNull) 
 				return SqlBoolean.Null;
 			else
-				return !x.Value.Equals (y.Value);
+				return new SqlBoolean (Compare (x, y) != 0);
 		}
 
 		public static SqlBoolean operator < (SqlBinary x, SqlBinary y)