2002-05-07 Tim Coleman <tim@timcoleman.com>
authorTim Coleman <tim@mono-cvs.ximian.com>
Tue, 7 May 2002 19:47:55 +0000 (19:47 -0000)
committerTim Coleman <tim@mono-cvs.ximian.com>
Tue, 7 May 2002 19:47:55 +0000 (19:47 -0000)
        * INullable.cs:
        * SqlBinary.cs:
        * SqlBoolean.cs:
        * SqlByte.cs:
        * SqlCompareOptions.cs:
        * SqlDateTime.cs:
        * SqlDecimal.cs:
        * SqlDouble.cs:
        * SqlGuid.cs:
        * SqlInt16.cs:
        * SqlInt32.cs:
        * SqlInt64.cs:
        * SqlMoney.cs:
        * SqlSingle.cs:
        * SqlString.cs:
                Implement CompareTo, Equals, and String conversions
                for many types

svn path=/trunk/mcs/; revision=4387

16 files changed:
mcs/class/System.Data/ChangeLog
mcs/class/System.Data/System.Data.SqlTypes/INullable.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlBoolean.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlByte.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlCompareOptions.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlDateTime.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlDecimal.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlGuid.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlInt16.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlInt32.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs

index c6a6debe2f830f90ef41ada93c6ad9d4906b7511..cc325adb86b2ce1dbe2c8efa9a5ff47cd1db1c0c 100644 (file)
@@ -1,3 +1,22 @@
+2002-05-07  Tim Coleman <tim@timcoleman.com>
+       * INullable.cs:
+       * SqlBinary.cs:
+       * SqlBoolean.cs:
+       * SqlByte.cs:
+       * SqlCompareOptions.cs:
+       * SqlDateTime.cs:
+       * SqlDecimal.cs:
+       * SqlDouble.cs:
+       * SqlGuid.cs:
+       * SqlInt16.cs:
+       * SqlInt32.cs:
+       * SqlInt64.cs:
+       * SqlMoney.cs:
+       * SqlSingle.cs:
+       * SqlString.cs:
+               Implement CompareTo, Equals, and String conversions 
+               for many types
+
 2002-05-05  Daniel Morgan <danmorg@sc.rr.com>
 
        * Test/PostgresTest.cs: modified to run completely.  There
index 8e551bad3c47db5a24119bf56e6303cd1b6b9d6e..cc4b6f9bb8f02266cf62546e1a8849a6385e3f95 100644 (file)
 namespace System.Data.SqlTypes
 {
        /// <summary>
-       /// All of the System.Data.SqlTypes objects and structures implement the INullable interface, reflecting the fact that, unlike the corresponding system types, SqlTypes can legally contain the value null.
+       /// All of the System.Data.SqlTypes objects and structures implement the INullable interface, 
+       /// reflecting the fact that, unlike the corresponding system types, SqlTypes can legally contain the value null.
        /// </summary>
        public interface INullable
        {
-               [MonoTODO]
                bool IsNull {
                        get;
                }
index 934fadf09307c454dba353d885f7105915384670..329956dda5e95dc31ca464baa33a763d25462749 100644 (file)
@@ -85,10 +85,12 @@ namespace System.Data.SqlTypes
                        return (x + y);
                }
 
-               [MonoTODO]
                public override bool Equals (object value) 
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlBinary))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals(SqlBinary x, SqlBinary y) 
index af224d895842ed196390747363247b8de190cdda..fce7c537499e8e3c208de1b238336fc2028977be 100644 (file)
@@ -94,16 +94,24 @@ namespace System.Data.SqlTypes
                        return (x & y);
                }
 
-               [MonoTODO]
                public int CompareTo (object value) 
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlBoolean))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlBoolean"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.ByteValue);
                }
 
-               [MonoTODO]
                public override bool Equals(object value) 
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlByte))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals(SqlBoolean x, SqlBoolean y) 
index 3a4894af0e41aba9536667fb0aed5937483aa567..aec24936b76f69a9e65a826954c1dd7eb7d2f943 100644 (file)
@@ -41,7 +41,7 @@ namespace System.Data.SqlTypes
                public byte Value { 
                        get { 
                                if (this.IsNull) 
-                                       throw new SqlNullValueException ("The property contains Null.");
+                                       throw new SqlNullValueException ();
                                else 
                                        return value; 
                        }
@@ -66,10 +66,16 @@ namespace System.Data.SqlTypes
                        return (x | y);
                }
 
-               [MonoTODO]
                public int CompareTo (object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlByte))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlByte"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
                public static SqlByte Divide (SqlByte x, SqlByte y)
@@ -77,10 +83,12 @@ namespace System.Data.SqlTypes
                        return (x / y);
                }
 
-               [MonoTODO]
                public override bool Equals (object value)
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlByte))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals (SqlByte x, SqlByte y)
@@ -133,10 +141,9 @@ namespace System.Data.SqlTypes
                        return ~x;
                }
 
-               [MonoTODO]
                public static SqlByte Parse (string s)
                {
-                       throw new NotImplementedException ();
+                       return new SqlByte (s.ToByte ());
                }
 
                public static SqlByte Subtract (SqlByte x, SqlByte y)
@@ -184,16 +191,17 @@ namespace System.Data.SqlTypes
                        return ((SqlSingle)this);
                }
 
-               [MonoTODO]
                public SqlString ToSqlString ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlString)this);
                }
 
-               [MonoTODO]
                public override string ToString ()
                {
-                       throw new NotImplementedException ();
+                       if (this.IsNull)
+                               return String.Empty;
+                       else
+                               return value.ToString ();
                }
 
                public static SqlByte Xor (SqlByte x, SqlByte y)
index 56583b1e78c346e55d29d063991d5cb2796c79f5..c07a93e220cfae883c75887b6e057e2392e8d832 100644 (file)
 
 namespace System.Data.SqlTypes
 {
-       /// <summary>\r
-       /// compare option values for SqlString\r
+       /// <summary>
+       /// compare option values for SqlString
        /// </summary>
-       [Flags]\r
-       [Serializable]\r
+       [Flags]
+       [Serializable]
        public enum SqlCompareOptions {
                BinarySort,
                IgnoreCase,
index 1d620a636212a8cb0b79410c82cf23b490f93986..4cbeb5f8dcbef44d7ace2e9e20d44fc3fd051ab7 100644 (file)
@@ -91,16 +91,24 @@ namespace System.Data.SqlTypes
 
                #region Methods
 
-               [MonoTODO]
                public int CompareTo (object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlDateTime))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlDateTime"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
-               [MonoTODO]
                public override bool Equals (object value)
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlDateTime))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals (SqlDateTime x, SqlDateTime y)
@@ -147,12 +155,15 @@ namespace System.Data.SqlTypes
 
                public SqlString ToSqlString ()
                {
-                       return new SqlString (value.ToString ());
+                       return ((SqlString)this);
                }
 
                public override string ToString ()
                {       
-                       return value.ToString ();
+                       if (this.IsNull)
+                               return String.Empty;
+                       else
+                               return value.ToString ();
                }
        
                [MonoTODO]      
index dca2964d6b71a218c0134678c583d3fb36ae4ccc..a0d7c44830a10562e86bbe56836734694495b00c 100644 (file)
@@ -14,13 +14,11 @@ namespace System.Data.SqlTypes
        public struct SqlDecimal : INullable, IComparable
        {
                #region Fields
+
                private decimal value;
 
                public static readonly byte MaxPrecision = 38; 
-
-               [MonoTODO]
-               public static readonly byte MaxScale;  // ????
-
+               public static readonly byte MaxScale = 28;
                public static readonly SqlDecimal MaxValue = new SqlDecimal (79228162514264337593543950335.0);
                public static readonly SqlDecimal MinValue = new SqlDecimal (-79228162514264337593543950335.0);
                public static readonly SqlDecimal Null;
@@ -52,13 +50,13 @@ namespace System.Data.SqlTypes
                [MonoTODO]
                public SqlDecimal (byte bPrecision, byte bScale, bool fPositive, int[] bits)
                {
-                       throw new NotImplementedException();
+                       throw new NotImplementedException ();
                }
 
                [MonoTODO]
                public SqlDecimal (byte bPrecision, byte bScale, bool fPositive, int data1, int data2, int data3, int data4) 
                {
-                       throw new NotImplementedException();
+                       throw new NotImplementedException ();
                }
 
                #endregion
@@ -70,9 +68,13 @@ namespace System.Data.SqlTypes
                        get { throw new NotImplementedException (); }
                }
 
-               [MonoTODO]
-               public byte[] Data { 
-                       get { throw new NotImplementedException (); }
+               public int[] Data { 
+                       get { 
+                               if (this.IsNull)
+                                       throw new SqlNullValueException ();
+                               else
+                                       return Decimal.GetBits (value);
+                       }
                }
 
                public bool IsNull { 
@@ -96,7 +98,7 @@ namespace System.Data.SqlTypes
                public decimal Value { 
                        get { 
                                if (this.IsNull) 
-                                       throw new SqlNullValueException ("The property contains Null.");
+                                       throw new SqlNullValueException ();
                                else 
                                        return value; 
                        }
@@ -129,10 +131,16 @@ namespace System.Data.SqlTypes
                        throw new NotImplementedException();
                }
 
-               [MonoTODO]
                public int CompareTo (object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlDecimal))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlDecimal"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
                [MonoTODO]
@@ -146,10 +154,12 @@ namespace System.Data.SqlTypes
                        return (x / y);
                }
 
-               [MonoTODO]
                public override bool Equals (object value)
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlDecimal))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals (SqlDecimal x, SqlDecimal y)
@@ -160,7 +170,7 @@ namespace System.Data.SqlTypes
                [MonoTODO]
                public static SqlDecimal Floor (SqlDecimal n)
                {
-                       throw new NotImplementedException();
+                       throw new NotImplementedException ();
                }
 
                [MonoTODO]
@@ -273,16 +283,17 @@ namespace System.Data.SqlTypes
                        return ((SqlSingle)this);
                }
 
-               [MonoTODO]
                public SqlString ToSqlString ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlString)this);
                }
 
-               [MonoTODO]
                public override string ToString ()
                {
-                       throw new NotImplementedException ();
+                       if (this.IsNull)
+                               return String.Empty;
+                       else
+                               return value.ToString ();
                }
 
                [MonoTODO]
index 4a70d78434920e77ecd18c0500c237a926f1964f..64ff9fb5cf4653844b8e75211f32540923dd499a 100644 (file)
@@ -41,7 +41,7 @@ namespace System.Data.SqlTypes
                public double Value { 
                        get { 
                                if (this.IsNull) 
-                                       throw new SqlNullValueException ("The property contains Null.");
+                                       throw new SqlNullValueException ();
                                else 
                                        return value; 
                        }
@@ -56,10 +56,16 @@ namespace System.Data.SqlTypes
                        return (x + y);
                }
 
-               [MonoTODO]
                public int CompareTo (object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlDouble))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlDouble"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
                public static SqlDouble Divide (SqlDouble x, SqlDouble y)
@@ -67,10 +73,12 @@ namespace System.Data.SqlTypes
                        return (x / y);
                }
 
-               [MonoTODO]
                public override bool Equals (object value)
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlDouble))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals (SqlDouble x, SqlDouble y)
@@ -164,16 +172,17 @@ namespace System.Data.SqlTypes
                        return ((SqlSingle)this);
                }
 
-               [MonoTODO]
                public SqlString ToSqlString ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlString)this);
                }
 
-               [MonoTODO]
                public override string ToString ()
                {
-                       throw new NotImplementedException ();
+                       if (this.IsNull)
+                               return String.Empty;
+                       else
+                               return value.ToString ();
                }
 
                public static SqlDouble operator + (SqlDouble x, SqlDouble y)
index 9a1a3c8e7a8e0881d2c5260d782f19f9767034a5..3ce87491a64be96d3bc1afcebd4b25975ceff737 100644 (file)
@@ -14,7 +14,8 @@ namespace System.Data.SqlTypes
        public struct SqlGuid : INullable, IComparable
        {
                #region Fields
-               private Guid value;
+
+               Guid value;
 
                public static readonly SqlGuid Null;
 
@@ -63,16 +64,24 @@ namespace System.Data.SqlTypes
 
                #region Methods
 
-               [MonoTODO]
                public int CompareTo (object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlGuid))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlGuid"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
-               [MonoTODO]
                public override bool Equals (object value)
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlGuid))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals (SqlGuid x, SqlGuid y)
@@ -123,22 +132,22 @@ namespace System.Data.SqlTypes
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                public SqlBinary ToSqlBinary ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlBinary)this);
                }
 
-               [MonoTODO]
                public SqlString ToSqlString ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlString)this);
                }
 
-               [MonoTODO]
                public override string ToString ()
                {
-                       throw new NotImplementedException ();
+                       if (this.IsNull)
+                               return String.Empty;
+                       else
+                               return value.ToString ();
                }
 
                public static SqlBoolean operator == (SqlGuid x, SqlGuid y)
index 3c4d19ec27e0f8ff8762742dfe4d62a543ec83e0..af2577038010524b72cdaeb50165f87a84f8d192 100644 (file)
@@ -42,7 +42,7 @@ namespace System.Data.SqlTypes
                public short Value { 
                        get { 
                                if (this.IsNull) 
-                                       throw new SqlNullValueException ("The property contains Null.");
+                                       throw new SqlNullValueException ();
                                else 
                                        return value; 
                        }
@@ -67,10 +67,16 @@ namespace System.Data.SqlTypes
                        return (x | y);
                }
 
-               [MonoTODO]
                public int CompareTo (object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlInt16))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlInt16"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
                public static SqlInt16 Divide (SqlInt16 x, SqlInt16 y)
@@ -78,10 +84,12 @@ namespace System.Data.SqlTypes
                        return (x / y);
                }
 
-               [MonoTODO]
                public override bool Equals (object value)
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlInt16))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals (SqlInt16 x, SqlInt16 y)
@@ -185,16 +193,17 @@ namespace System.Data.SqlTypes
                        return ((SqlSingle)this);
                }
 
-               [MonoTODO]
                public SqlString ToSqlString ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlString)this);
                }
 
-               [MonoTODO]
                public override string ToString ()
                {
-                       throw new NotImplementedException ();
+                       if (this.IsNull)
+                               return String.Empty;
+                       else
+                               return value.ToString ();
                }
 
                public static SqlInt16 Xor (SqlInt16 x, SqlInt16 y)
index c64a2d853779c836df8a17103dbca0d739ece050..950cff59cebca58f4d516013886cf4aae1d31469 100644 (file)
@@ -50,7 +50,7 @@ namespace System.Data.SqlTypes
                public int Value {
                        get { 
                                if (this.IsNull) 
-                                       throw new SqlNullValueException ("The property contains Null.");
+                                       throw new SqlNullValueException ();
                                else 
                                        return value; 
                        }
@@ -75,10 +75,16 @@ namespace System.Data.SqlTypes
                        return (x | y);
                }
 
-               [MonoTODO]
                public int CompareTo(object value) 
                {
-                       throw new NotImplementedException ();   
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlInt32))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlInt32"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
                public static SqlInt32 Divide(SqlInt32 x, SqlInt32 y) 
@@ -86,10 +92,12 @@ namespace System.Data.SqlTypes
                        return (x / y);
                }
 
-               [MonoTODO]
                public override bool Equals(object value) 
                {
-                       throw new NotImplementedException ();   
+                       if (!(value is SqlInt32))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals(SqlInt32 x, SqlInt32 y) 
@@ -192,16 +200,17 @@ namespace System.Data.SqlTypes
                        return ((SqlSingle)this);
                }
 
-               [MonoTODO]
                public SqlString ToSqlString ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlString)this);
                }
 
-               [MonoTODO]
                public override string ToString() 
                {
-                       throw new NotImplementedException ();   
+                       if (this.IsNull)
+                               return String.Empty;
+                       else
+                               return value.ToString ();
                }
 
                public static SqlInt32 Xor(SqlInt32 x, SqlInt32 y) 
index 7c9d922a5e7084f9a3e8307029270675d145f22d..af3361aa85353c05d4e39753bb559943c5460347 100644 (file)
@@ -39,7 +39,6 @@ namespace System.Data.SqlTypes
 
                #region Properties
 
-               [MonoTODO]
                public bool IsNull { 
                        get { return (bool) (this == Null); }
                }
@@ -47,7 +46,7 @@ namespace System.Data.SqlTypes
                public long Value { 
                        get { 
                                if (this.IsNull) 
-                                       throw new SqlNullValueException ("The property contains Null.");
+                                       throw new SqlNullValueException ();
                                else 
                                        return value; 
                        }
@@ -72,10 +71,16 @@ namespace System.Data.SqlTypes
                        return (x | y);
                }
 
-               [MonoTODO]
                public int CompareTo (object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlInt64))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlInt64"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
                public static SqlInt64 Divide (SqlInt64 x, SqlInt64 y)
@@ -83,10 +88,12 @@ namespace System.Data.SqlTypes
                        return (x / y);
                }
 
-               [MonoTODO]
                public override bool Equals (object value)
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlInt64))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals (SqlInt64 x, SqlInt64 y)
@@ -191,16 +198,14 @@ namespace System.Data.SqlTypes
                        return ((SqlSingle)this);
                }
 
-               [MonoTODO]
                public SqlString ToSqlString ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlString)this);
                }
 
-               [MonoTODO]
                public override string ToString ()
                {
-                       throw new NotImplementedException ();
+                       return value.ToString ();
                }
 
                public static SqlInt64 Xor (SqlInt64 x, SqlInt64 y)
index 2c298c06821415daa93ba22fcb4cfaf0611283ff..c0f646ceee816ccaacdd62d0a9d54989a0694cd4 100644 (file)
@@ -58,7 +58,7 @@ namespace System.Data.SqlTypes
                public decimal Value { 
                        get { 
                                if (this.IsNull) 
-                                       throw new SqlNullValueException ("The property contains Null.");
+                                       throw new SqlNullValueException ();
                                else 
                                        return value; 
                        }
@@ -73,10 +73,16 @@ namespace System.Data.SqlTypes
                        return (x + y);
                }
 
-               [MonoTODO]
                public int CompareTo (object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlMoney))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlMoney"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
                public static SqlMoney Divide (SqlMoney x, SqlMoney y)
@@ -84,10 +90,12 @@ namespace System.Data.SqlTypes
                        return (x / y);
                }
 
-               [MonoTODO]
                public override bool Equals (object value)
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlMoney))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals (SqlMoney x, SqlMoney y)
@@ -202,16 +210,17 @@ namespace System.Data.SqlTypes
                        return ((SqlSingle)this);
                }
 
-               [MonoTODO]
                public SqlString ToSqlString ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlString)this);
                }
 
-               [MonoTODO]
                public override string ToString ()
                {
-                       throw new NotImplementedException ();
+                       if (this.IsNull)
+                               return String.Empty;
+                       else
+                               return value.ToString ();
                }
 
                public static SqlMoney operator + (SqlMoney x, SqlMoney y)
index c024727d30a9efef277942d158f428ef3c239fdc..563e5952337e88cb65b8b2edc33418e7345411f3 100644 (file)
@@ -47,7 +47,7 @@ namespace System.Data.SqlTypes
                public float Value { 
                        get { 
                                if (this.IsNull) 
-                                       throw new SqlNullValueException ("The property contains Null.");
+                                       throw new SqlNullValueException ();
                                else 
                                        return value; 
                        }
@@ -62,10 +62,16 @@ namespace System.Data.SqlTypes
                        return (x + y);
                }
 
-               [MonoTODO]
                public int CompareTo (object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlSingle))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlSingle"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
                public static SqlSingle Divide (SqlSingle x, SqlSingle y)
@@ -73,10 +79,12 @@ namespace System.Data.SqlTypes
                        return (x / y);
                }
 
-               [MonoTODO]
                public override bool Equals (object value)
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlSingle))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals (SqlSingle x, SqlSingle y)
@@ -172,16 +180,14 @@ namespace System.Data.SqlTypes
                }
 
 
-               [MonoTODO]
                public SqlString ToSqlString ()
                {
-                       throw new NotImplementedException ();
+                       return ((SqlString)this);
                }
 
-               [MonoTODO]
                public override string ToString ()
                {
-                       throw new NotImplementedException ();
+                       return value.ToString ();
                }
 
                public static SqlSingle operator + (SqlSingle x, SqlSingle y)
index 96322c48d800bbca77c90d21612b366aed44dd71..f5f95192d580dbdae5d59858afe041736ce0b557 100644 (file)
@@ -145,7 +145,7 @@ namespace System.Data.SqlTypes
                }
 
                [MonoTODO]
-               public static CompareOptions CompareOptionsFromSqlCompareOptions ( SqlCompareOptions compareOptions) 
+               public static CompareOptions CompareOptionsFromSqlCompareOptions (SqlCompareOptions compareOptions) 
                {
                        throw new NotImplementedException ();
                }
@@ -154,10 +154,16 @@ namespace System.Data.SqlTypes
                // Comparison Methods
                // **********************************
 
-               [MonoTODO]
                public int CompareTo(object value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               return 1;
+                       else if (!(value is SqlString))
+                               throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlString"));
+                       else if (value.IsNull)
+                               return 1;
+                       else
+                               return value.CompareTo (value.Value);
                }
 
                public static SqlString Concat(SqlString x, SqlString y) 
@@ -165,10 +171,12 @@ namespace System.Data.SqlTypes
                        return (x + y);
                }
 
-               [MonoTODO]
                public override bool Equals(object value) 
                {
-                       throw new NotImplementedException ();
+                       if (!(value is SqlGuid))
+                               return false;
+                       else
+                               return (bool) (this == value);
                }
 
                public static SqlBoolean Equals(SqlString x, SqlString y) 
@@ -355,7 +363,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.ByteValue.ToString ());
                }
 
                public static explicit operator SqlString (SqlByte x) 
@@ -363,7 +371,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator SqlString (SqlDateTime x) 
@@ -371,7 +379,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator SqlString (SqlDecimal x) 
@@ -379,7 +387,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator SqlString (SqlDouble x) 
@@ -387,7 +395,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator SqlString (SqlGuid x) 
@@ -395,7 +403,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator SqlString (SqlInt16 x) 
@@ -403,7 +411,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator SqlString (SqlInt32 x) 
@@ -411,7 +419,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator SqlString (SqlInt64 x) 
@@ -419,7 +427,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator SqlString (SqlMoney x) 
@@ -427,7 +435,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator SqlString (SqlSingle x) 
@@ -435,7 +443,7 @@ namespace System.Data.SqlTypes
                        if (x.IsNull)
                                return Null;
                        else
-                               return new SqlString (x.ToString ());
+                               return new SqlString (x.Value.ToString ());
                }
 
                public static explicit operator string (SqlString x)