[Mono-list] ExpressionElement.cs patch

Marco Canini marco.canini@fastwebnet.it
Wed, 08 Oct 2003 19:27:32 +0200


--=-I1nlH43OeLy5C4PfKo7g
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Tue, 2003-10-07 at 01:49, Marco Canini wrote:
> This patch solves a problem in ExpressionSingleElement class when using
> integer number bigger than Int32.Max or floating point number.
> I've also added the support for datetime.
> I've tested it with my app and now i don't get an overflow exception.
Ok, i forgot an 'else' in the second if, please use this patch.
-- 
Marco Canini <marco.canini@fastwebnet.it>

--=-I1nlH43OeLy5C4PfKo7g
Content-Disposition: attachment; filename=patchfile2
Content-Type: text/x-patch; name=patchfile2; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

Index: ExpressionElement.cs
===================================================================
RCS file: /mono/mcs/class/System.Data/System.Data/ExpressionElement.cs,v
retrieving revision 1.4
diff -r1.4 ExpressionElement.cs
1648a1649,1652
> 			else if (s.StartsWith ("#") && s.EndsWith ("#")) {
> 				Element = DateTime.Parse (s.Substring (1, s.Length - 2));
> 				_ResultType = typeof (DateTime);
> 			}
1654,1655c1658,1659
< 				_ResultType = typeof (int);
< 				Element = int.Parse (s);
---
> 				Element = Decimal.Parse (s);
> 				_ResultType = typeof (Decimal);
1771d1774
< 			// If one of elements are string they both should be??? FIXME 
1772a1776
> 				// FIXME: If one of elements are string they both should be???				
1785,1791c1789
< 			}
< 			else if (t1 != t2) {
< 				
< 				value2 = Convert.ChangeType (value2, Type.GetTypeCode (t1));
< 			}
< 
< 			else if (t1 != t2) {
---
> 			} else if (t1 != t2) {

--=-I1nlH43OeLy5C4PfKo7g--