[Mono-dev] System.Data.SqlClient TDS 7.0 bigint issue

tsureshkumar tsureshkumar at novell.com
Thu Aug 11 03:02:15 EDT 2005


Kornél Pál wrote:
> Hi,
> 
> If you have opinion about this issue please comment it. If the idea will be
> approved I'll propose a patch.
> 
> Look at bug http://bugzilla.ximian.com/show_bug.cgi?id=53169
> 
> The problem is that Decimal is returned instead of Int64.
> 
> This is a limitation of TDS 7.0 used by Mono. .NET Framework uses TDS 8.0.
> 
> It is difficult to fix as TDS 8.0 should be implemented.
> 
> I committed a workaround that makes GetInt64 and GetSqlInt64 able to
> read decimal(19,0). But there is no way in TDS 7.0 to determine
> whether the type is bigint.
> 
> If you use GetValue or GetSqlValue you will get Decimal or SqlDecimal.
> 
> GetValue seems to be used by Mono users as well. And I think it's more
> likely to use bigint in an MS SQL database than decimal(19,0).
> 
> What about trating decimal(19,0) as bigint but let GetDecimal and
> GetSqlDecimal to return decimal(19,0)? (This would be the revrse of the
> current solution.)

If I understand your point correctly, you say  that GetValue () should 
return a type of BigInt, instead of Decimal for decimal (19, 0).

I think  this has a potential of treating a decimal field as bigint and 
overflow the Int64. bigint uses 8 bytes whereas decimal uses 9 bytes. 
10^19 is higher than 2^63. I think bigint to decimal is a safe cast, but 
  not the vice versa.  Ofcourse, in practical, people choose bigint if 
they want higher capacity and our problem lies in, if they want to use 
those extra 7 bits in decimal (19,0) and we are not letting them to use 
through mono, if we follow this approach.

> 
> Kornél
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list