[Mono-dev] Review of Sql.Data.SqlClient Patches

John Mortlock johnm at hlaustralia.com.au
Mon Oct 27 05:59:55 EDT 2008


Hi

Can someone please take a look at the following patches for two current bug reports.

First is for bug #428139 - Negative Money Stored Procedure Parameter
https://bugzilla.novell.com/show_bug.cgi?id=428139

--- Tds70.cs	(revision 113639)
+++ Tds70.cs	(working copy)
@@ -1,4 +1,4 @@ 
-//
+?//
 // Mono.Data.Tds.Protocol.Tds70.cs
 //
 // Author:
@@ -463,9 +463,14 @@ 
 				case "money" : {
 					Decimal val = (decimal) param.Value;
 					int[] arr = Decimal.GetBits (val);
-					int sign = (val>0 ? 1: -1);
-					Comm.Append (sign * arr[1]);
-					Comm.Append (sign * arr[0]);
+					if (val >= 0) {
+						Comm.Append (arr[1]);
+						Comm.Append (arr[0]);
+					}
+					else {
+						Comm.Append (~arr[1]);
+						Comm.Append (~arr[0] + 1);					
+					}
 					break;
 				}
 				case "smallmoney": {


Next is for Bug 360750 - Empty string being send instead of dbnull
https://bugzilla.novell.com/show_bug.cgi?id=360750

Index: SqlParameter.cs
===================================================================
--- SqlParameter.cs	(revision 112723)
+++ SqlParameter.cs	(working copy)
@@ -1,4 +1,4 @@
-//
+?//
 // System.Data.SqlClient.SqlParameter.cs
 //
 // Author:
@@ -865,7 +865,7 @@
 				return value;
 			
 			if (value is string && ((string)value).Length == 0)
-				return DBNull.Value;
+				return String.Empty;
 			
 			switch (sqlDbType)  {
 			case SqlDbType.BigInt :


--- Tds70.cs	(revision 113127)
+++ Tds70.cs	(working copy)
@@ -1,4 +1,4 @@ 
-//
+?//
 // Mono.Data.Tds.Protocol.Tds70.cs
 //
 // Author:
@@ -446,7 +446,9 @@ 
 			}
 
 			size = param.GetActualSize ();
-			if (IsLargeType (colType))
+			if (size == 0 && (param.TypeName == "varchar" || param.TypeName == "nvarchar") && (param.Value == DBNull.Value || param.Value == null))
+				Comm.Append((ushort)0xFFFF);			
+			else if (IsLargeType (colType))
 				Comm.Append ((short)size);
 			else if (IsBlobType (colType))
 				Comm.Append (size);


Thanks 
John Mortlock
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081027/6cc562c0/attachment.html 


More information about the Mono-devel-list mailing list