[Mono-bugs] [Bug 66630][Nor] New - [PATCH] TDS70 : Wrong conversion for enum-based parameter values

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 22 Sep 2004 15:37:09 -0400 (EDT)


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 gert.driesen@pandora.be.

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

--- shadow/66630	2004-09-22 15:37:09.000000000 -0400
+++ shadow/66630.tmp.21017	2004-09-22 15:37:09.000000000 -0400
@@ -0,0 +1,66 @@
+Bug#: 66630
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [PATCH] TDS70 : Wrong conversion for enum-based parameter values 
+
+When a enum-based value is specified as parameter value, that value is 
+always converted to the enum field name (bzcause value.ToString() is 
+used), resulting in the following exception :
+
+Unhandled Exception: System.Data.SqlClient.SqlException: Error converting 
+data type nvarchar to smallint.
+in <0x0011b> System.Data.SqlClient.SqlConnection:ErrorHandler 
+(object,Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
+in <0x00069> (wrapper delegate-invoke) 
+System.MulticastDelegate:invoke_void_object_TdsInternalErrorMessageEventAr
+gs (object,Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
+in <0x00031> Mono.Data.Tds.Protocol.Tds:OnTdsErrorMessage 
+(Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
+in <0x00056> (wrapper remoting-invoke-with-check) 
+Mono.Data.Tds.Protocol.Tds:OnTdsErrorMessage 
+(Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
+in <0x00276> Mono.Data.Tds.Protocol.Tds:ProcessMessage 
+(Mono.Data.Tds.Protocol.TdsPacketSubType)
+in <0x00052> (wrapper remoting-invoke-with-check) 
+Mono.Data.Tds.Protocol.Tds:ProcessMessage 
+(Mono.Data.Tds.Protocol.TdsPacketSubType)
+in <0x0015f> Mono.Data.Tds.Protocol.Tds:ProcessSubPacket ()
+in <0x00050> Mono.Data.Tds.Protocol.Tds:NextResult ()
+in <0x00089> System.Data.SqlClient.SqlDataReader:NextResult ()
+in <0x0005d> (wrapper remoting-invoke-with-check) 
+System.Data.SqlClient.SqlDataReader:NextResult ()
+in <0x00122> System.Data.SqlClient.SqlDataReader:.ctor 
+(System.Data.SqlClient.SqlCommand)
+in <0x00056> (wrapper remoting-invoke-with-check) 
+System.Data.SqlClient.SqlDataReader:.ctor 
+(System.Data.SqlClient.SqlCommand)
+in <0x000a2> System.Data.SqlClient.SqlCommand:ExecuteReader 
+(System.Data.CommandBehavior)
+in <0x00054> (wrapper remoting-invoke-with-check) 
+System.Data.SqlClient.SqlCommand:ExecuteReader 
+(System.Data.CommandBehavior)
+in <0x00016> System.Data.SqlClient.SqlCommand:ExecuteReader ()
+in <0x00050> (wrapper remoting-invoke-with-check) 
+System.Data.SqlClient.SqlCommand:ExecuteReader ()
+in <0x00102> ConsoleApplication1.Class1:Main (string[])
+
+However, when the parameter is numeric, the underlying value of the enum 
+should be converted to string instead.
+
+The attached patch corrects this issue.
+
+I'm not sure how to provide a test case that for this issue that does not 
+need an actual database connection.