diff options
author | Kornél Pál <kornelpal@gmail.com> | 2005-05-20 22:06:02 +0400 |
---|---|---|
committer | Kornél Pál <kornelpal@gmail.com> | 2005-05-20 22:06:02 +0400 |
commit | c6e989717ab0a00d6c86f96a0903a081fd8daa70 (patch) | |
tree | 66f8e2f961f405de8c0bf45cf03d3043c05658b0 /mcs/class/System.Data/System.Data.SqlClient | |
parent | b602a4462a56e015ce0b4404c3331479fff040d6 (diff) |
Fixed Bug #53169
svn path=/trunk/mcs/; revision=44841
Diffstat (limited to 'mcs/class/System.Data/System.Data.SqlClient')
-rwxr-xr-x | mcs/class/System.Data/System.Data.SqlClient/ChangeLog | 8 | ||||
-rw-r--r-- | mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs | 12 |
2 files changed, 19 insertions, 1 deletions
diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog index c8053c9af2a..0be2f3abe5c 100755 --- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog @@ -1,3 +1,9 @@ +2005-05-20 Kornél Pál <http://www.kornelpal.hu/> + + * Fixed Bug #53169 - SqlDataReader incorrectly returns bigint as decimal + Note: The fix works around the limitations of TDS 7.0 to avoid this + difference between Mono and .NET Framework TDS 8.0 should be used instead. + 2005-05-20 Umadevi S <sumadevi@novell.com> * Fixed Bug 74948 - SqlParameter also takes DBNull Value. @@ -315,7 +321,7 @@ these * SqlCommand.cs (ExecuteNonQuery): Return Connection.Tds.RecordsAffected if it is successful. Patch from - Jörg Rosenkranz <joergr@voelcker.com>. + Jörg Rosenkranz <joergr@voelcker.com>. This is part of a fix to bug #40315. diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs index b19ec84bb9d..58641400d12 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs @@ -453,6 +453,12 @@ namespace System.Data.SqlClient { long GetInt64 (int i) { object value = GetValue (i); + // TDS 7.0 returns bigint as decimal(19,0) + if (value is decimal) { + TdsDataColumn schema = command.Tds.Columns[i]; + if ((byte)schema["NumericPrecision"] == 19 && (byte)schema["NumericScale"] == 0) + value = (long) (decimal) value; + } if (!(value is long)) { if (value is DBNull) throw new SqlNullValueException (); throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); @@ -772,6 +778,12 @@ namespace System.Data.SqlClient { public SqlInt64 GetSqlInt64 (int i) { object value = GetSqlValue (i); + // TDS 7.0 returns bigint as decimal(19,0) + if (value is SqlDecimal) { + TdsDataColumn schema = command.Tds.Columns[i]; + if ((byte)schema["NumericPrecision"] == 19 && (byte)schema["NumericScale"] == 0) + value = (SqlInt64) (SqlDecimal) value; + } if (!(value is SqlInt64)) throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); return (SqlInt64) value; |