[Mono-bugs] [Bug 62150][Wis] Changed - Idea for some exception handling speedups

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Oct 3 08:38:21 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 informatique.internet at fiducial.fr.

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

--- shadow/62150	2005-10-03 07:06:03.000000000 -0400
+++ shadow/62150.tmp.2643	2005-10-03 08:38:21.000000000 -0400
@@ -42,6 +42,104 @@
 dipping his toes in the mono jit internals, too.
 
 ------- Additional Comments From informatique.internet at fiducial.fr  2005-10-03 07:06 -------
 I've seen you've made a patch to "improve" exception handling...
 There's some "NullException" problem on my projects... If i revert
 your changes it works... I'm working on a test case!
+
+------- Additional Comments From informatique.internet at fiducial.fr  2005-10-03 08:38 -------
+// project created on 03/10/2005 at 11:30
+using System;
+using System.Data;
+using System.Data.OracleClient;
+
+
+class MainClass
+{
+
+
+
+  private static void CreateDummy()
+  {
+   IDbConnection sqlCon = new OracleConnection("user id=hubert;data
+source=10.69.100.181:1521/ORALINUX;password=cosmic");
+   IDbCommand command = sqlCon.CreateCommand();
+   command.Connection = sqlCon;
+   sqlCon.Open();
+   command.CommandText =
+    @" DROP TABLE INTRA_LANGUE CASCADE CONSTRAINTS";
+    try{
+   command.ExecuteNonQuery();
+   }catch(Exception e)
+   {}
+   command.CommandText =
+    @" CREATE TABLE INTRA_LANGUE (LANGUE_CODE VARCHAR2(40) NOT
+NULL,LANGUE VARCHAR2(100),	CONSTRAINT PK_INTRA_LANGUE PRIMARY KEY
+(LANGUE_CODE))";
+   command.ExecuteNonQuery();
+   sqlCon.Close();
+  }
+
+public void checkexception(Exception e, IDbCommand command, string stack)
+{
+	Console.WriteLine(e.GetType().ToString());
+	try
+	{
+		throw e;
+	}
+	catch (OracleException ee)
+	{
+		Console.WriteLine("OracleException :::"+ee.Message);
+		Console.WriteLine("Command text :"+command.CommandText);
+		foreach (IDataParameter param in command.Parameters)
+		{
+			Console.WriteLine(param.ParameterName);
+			Console.WriteLine(param.Value.ToString());
+		}
+
+	}
+}
+
+  public void Test()
+  {
+   IDbCommand command=new OracleCommand();
+   try
+   {
+   NSUniDataAccess.UniDataAccess.SetDb("Oracle");
+   IDbConnection sqlCon =
+NSUniDataAccess.UniDataAccess.GetConnection("user id=hubert;data
+source=10.69.100.181:1521/ORALINUX;password=cosmic");
+   command = sqlCon.CreateCommand();
+   command.Connection = sqlCon;
+   sqlCon.Open();
+	OracleParameter p1 = new OracleParameter("param1",OracleType.VarChar);
+	p1.Value = "en";
+	OracleParameter p2 = new OracleParameter("param2",OracleType.VarChar);
+	p2.Value = "english";
+	command.Parameters.Add(p1);
+	command.Parameters.Add(p2);
+   	command.CommandText =
+    @" INSERT INTO INTRA_LANGUE (LANGUE_CODE,LANGUE)
+VALUES(:param1,:param2)";
+   command.ExecuteNonQuery();
+   command.CommandText =
+    @" INSERT INTO INTRA_LANGUE (LANGUE_CODE,LANGUE)
+VALUES(:param1,:param2)";
+   // Should throw a Unique constraint exception...
+   command.ExecuteNonQuery();
+   sqlCon.Close();
+   }
+   catch(Exception e)
+   {
+	Console.WriteLine("oops : execption");
+    checkexception(e,command,e.StackTrace);
+   }
+   return;
+  }
+	public static void Main(string[] args)
+	{
+		CreateDummy();
+		Console.WriteLine("Hello World!");
+		MainClass monprog=new MainClass();
+		monprog.Test();
+	}
+}


More information about the mono-bugs mailing list