[Mono-bugs] [Bug 62978][Nor] New - Sorry, I reported 4 bugs at once - please split the report
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 12 Aug 2004 17:39:23 -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 info@x-tensive.com.
http://bugzilla.ximian.com/show_bug.cgi?id=62978
--- shadow/62978 2004-08-12 17:39:23.000000000 -0400
+++ shadow/62978.tmp.19506 2004-08-12 17:39:23.000000000 -0400
@@ -0,0 +1,121 @@
+Bug#: 62978
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: info@x-tensive.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Sorry, I reported 4 bugs at once - please split the report
+
+using System;
+using System.Reflection;
+using System.Data;
+using System.Data.SqlClient;
+
+namespace MonoTest
+{
+ class MonoBugs
+ {
+ public class A
+ {
+ private IComparable value;
+
+ public A(IComparable value)
+ {
+ this.value = value;
+ }
+ }
+
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Type typeA = typeof(A);
+ object[] invokeArgs = {1};
+ A objA = (A)typeA.InvokeMember( "", // Mono InvokeMember bug: it
+doesn't correctly cast invokeArgs[0] to IComparable!
+ BindingFlags.DeclaredOnly |
+ BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.Instance |
+ BindingFlags.CreateInstance,
+ null, null, invokeArgs
+ );
+ Console.WriteLine("Success:"+objA);
+
+ SqlParameter p = new SqlParameter("@P1", DBNull.Value);
+ Console.WriteLine("Success:"+p);
+
+ string strCreateTable = "Create table [A] ( [ID] bigint identity
+(1,1) not Null, [F1] image default Null)";
+ string strDropTable = "Drop table [A]";
+ string strInsertRow = "insert into [A]([F1]) values(@P1)";
+
+ SqlCommand cmd = new SqlCommand(strDropTable);
+ cmd.Connection = new SqlConnection("Data Source=localhost;Initial
+Catalog=DataObjectsDotNetDemos;User ID=admin;Password=admin");
+ cmd.Connection.Open();
+ cmd.ExecuteNonQuery();
+ cmd.CommandText = strCreateTable;
+ cmd.ExecuteNonQuery();
+ SqlParameter p = new SqlParameter();
+ p.ParameterName = "@P1";
+// p.Value = new byte[0]; // Mono SqlClient bug 1: it doesn't accept
+this value
+ p.Value = DBNull.Value; // Mono SqlClient bug 2: it doesn't accept
+this value
+ p.DbType = DbType.Binary;
+ cmd.Parameters.Add(p);
+ cmd.CommandText = strInsertRow;
+ cmd.ExecuteNonQuery();
+
+ string strCreateTable = "Create table [A] ( [ID] bigint identity
+(1,1) not Null, [F1] image default Null)";
+ string strDropTable = "Drop table [A]";
+ string strInsertRow = "insert into [A]([F1]) values(@P1)\nSelect
+[ID] from [A]";
+ byte[] data = {1};
+
+ SqlCommand cmd = new SqlCommand(strDropTable);
+ cmd.Connection = new SqlConnection("Data Source=localhost;Initial
+Catalog=DataObjectsDotNetDemos;User ID=admin;Password=admin");
+ cmd.Connection.Open();
+ cmd.ExecuteNonQuery();
+ cmd.CommandText = strCreateTable;
+ cmd.ExecuteNonQuery();
+ SqlParameter p = new SqlParameter();
+ p.ParameterName = "@P1";
+ p.Value = data;
+ p.DbType = DbType.Binary;
+ cmd.Parameters.Add(p);
+ cmd.CommandText = strInsertRow;
+
+ SqlDataReader r = cmd.ExecuteReader();
+ using (r) {
+ try {
+ if (r.Read()) {
+ long id = r.GetInt64(0); // Mono SqlClient bug 3: doesn't
+fetch Int64, but should. r.GetDecimal(0) passes on Mono here.
+ }
+ }
+ finally {
+ r.NextResult(); // .NET SqlClient bug walkaround.
+ // Read ms-
+help://MS.MSDNQTR.2003APR.1033/enu_kbwebdatanetkb/webdatanetkb/316667.htm
+ }
+ }
+
+ cmd.Connection.Close();
+
+ Console.ReadLine();
+ }
+ }
+}