[Mono-bugs] [Bug 75177][Nor] New - Read Decimal; NULL Value gives overflow Exception

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jun 8 08:41:41 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by timo-mono at pokorra.de.

http://bugzilla.ximian.com/show_bug.cgi?id=75177

--- shadow/75177	2005-06-08 08:41:41.000000000 -0400
+++ shadow/75177.tmp.26812	2005-06-08 08:41:41.000000000 -0400
@@ -0,0 +1,49 @@
+Bug#: 75177
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: timo-mono at pokorra.de               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Read Decimal; NULL Value gives overflow Exception
+
+Description of Problem:
+When reading the result of a query, and a decimal column returns a NULL
+value, it gives the exception: 
+System.OverflowException: Number overflow.
+
+Steps to reproduce the problem:
+1. sql statement including a decimal column, that is NULL
+
+Actual Results:
+System.OverflowException: Number overflow.
+
+Expected Results:
+DBNull.Value
+
+How often does this happen? 
+Always
+
+Additional Information:
+
+The problem is in OdbcDataReader.cs, GetValue(int):
+outsize is -1; new byte [-1] raises the exception.
+
+fix:
+if (outsize!=-1)
+{
+   byte[] temp = new byte[outsize];
+   for (int i=0;i<outsize;i++)
+      temp[i]=buffer[i];
+   DataValue=Decimal.Parse(System.Text.Encoding.Default.GetString(temp));
+}
+else DataValue = DBNull.Value;


More information about the mono-bugs mailing list