diff options
author | Raja R Harinath <harinath@hurrynot.org> | 2005-09-15 18:20:10 +0400 |
---|---|---|
committer | Raja R Harinath <harinath@hurrynot.org> | 2005-09-15 18:20:10 +0400 |
commit | b05216ac323c36e17109fc24310c77adfc302012 (patch) | |
tree | e6d34b2000b12f0425376141af872d429a87904c /mcs/class/System.Data/System.Data.SqlTypes | |
parent | b34f959749f6f939e82d2ce63232124bf8d40c22 (diff) |
* SqlString.cs (MoneyFormat): Move to SqlMoney.cs.
(operator SqlString) [SqlMoney variant]: Delegate to
SqlMoney.ToString ().
* SqlMoney.cs (MoneyFormat): Move from SqlString.cs.
(SqlString): New static constructor.
(ToString): Use it.
svn path=/trunk/mcs/; revision=50085
Diffstat (limited to 'mcs/class/System.Data/System.Data.SqlTypes')
-rw-r--r-- | mcs/class/System.Data/System.Data.SqlTypes/ChangeLog | 9 | ||||
-rw-r--r-- | mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs | 11 | ||||
-rw-r--r-- | mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs | 8 |
3 files changed, 20 insertions, 8 deletions
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/ChangeLog b/mcs/class/System.Data/System.Data.SqlTypes/ChangeLog index 91156c07fd0..ae3fd3955ab 100644 --- a/mcs/class/System.Data/System.Data.SqlTypes/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlTypes/ChangeLog @@ -1,3 +1,12 @@ +2005-09-15 Raja R Harinath <rharinath@novell.com> + + * SqlString.cs (MoneyFormat): Move to SqlMoney.cs. + (operator SqlString) [SqlMoney variant]: Delegate to + SqlMoney.ToString (). + * SqlMoney.cs (MoneyFormat): Move from SqlString.cs. + (SqlString): New static constructor. + (ToString): Use it. + 2005-09-02 Umadevi S <sumadevi@novell.com> * SqlXml.cs : Added a dummy placeholder to compile MicrosoftServer namespace diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs index 1d9d1011985..42486698d1e 100644 --- a/mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs +++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs @@ -49,10 +49,19 @@ namespace System.Data.SqlTypes public static readonly SqlMoney Null; public static readonly SqlMoney Zero = new SqlMoney (0); + private static readonly NumberFormatInfo MoneyFormat; + #endregion #region Constructors + static SqlMoney () + { + MoneyFormat = (NumberFormatInfo) NumberFormatInfo.InvariantInfo.Clone (); + MoneyFormat.NumberDecimalDigits = 4; + MoneyFormat.NumberGroupSeparator = String.Empty; + } + public SqlMoney (decimal value) { if (value > 922337203685477.5807m || value < -922337203685477.5808m) @@ -265,7 +274,7 @@ namespace System.Data.SqlTypes if (!notNull) return "Null"; else - return value.ToString (); + return value.ToString ("N", MoneyFormat); } public static SqlMoney operator + (SqlMoney x, SqlMoney y) diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs index 5e5f963f91e..7108b0b5d01 100644 --- a/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs +++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs @@ -64,7 +64,6 @@ namespace System.Data.SqlTypes public static readonly int IgnoreWidth = 0x10; public static readonly SqlString Null; - internal static readonly NumberFormatInfo MoneyFormat; internal static NumberFormatInfo DecimalFormat; #endregion // Fields @@ -72,10 +71,6 @@ namespace System.Data.SqlTypes static SqlString () { - MoneyFormat = (NumberFormatInfo) NumberFormatInfo.InvariantInfo.Clone (); - MoneyFormat.NumberDecimalDigits = 4; - MoneyFormat.NumberGroupSeparator = String.Empty; - DecimalFormat = (NumberFormatInfo) NumberFormatInfo.InvariantInfo.Clone (); DecimalFormat.NumberDecimalDigits = 13; DecimalFormat.NumberGroupSeparator = String.Empty; @@ -602,8 +597,7 @@ namespace System.Data.SqlTypes if (x.IsNull) return Null; else - return new SqlString (x.Value.ToString ()); - // return new SqlString (x.Value.ToString ("N", MoneyFormat)); + return new SqlString (x.ToString ()); } public static explicit operator SqlString (SqlSingle x) |