ソースを参照

2002-05-29 Rodrigo Moya <[email protected]>

	* libgda.cs: added static constructor.
	(GdaClient): new static property to get the underlying GdaClient
	object.

	* OleDbConnection.cs: removed GDA initialization, which belongs to
	the static 'libgda' class.

svn path=/trunk/mcs/; revision=5011
Rodrigo Moya 23 年 前
コミット
cca4ebf9d3

+ 9 - 0
mcs/class/System.Data/System.Data.OleDb/ChangeLog

@@ -1,3 +1,12 @@
+2002-05-29  Rodrigo Moya <[email protected]>
+
+	* libgda.cs: added static constructor.
+	(GdaClient): new static property to get the underlying GdaClient
+	object.
+
+	* OleDbConnection.cs: removed GDA initialization, which belongs to
+	the static 'libgda' class.
+
 2002-05-29  Rodrigo Moya <[email protected]>
 
 	* libgda.cs: static class for libgda API calls.

+ 0 - 5
mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs

@@ -15,17 +15,12 @@ namespace System.Data.OleDb
 {
 	public sealed class OleDbConnection : Component, ICloneable, IDbConnection
 	{
-		private IntPtr m_gdaClient = IntPtr.Zero;
 		private IntPtr m_gdaConnection = IntPtr.Zero;
 		private string m_string = "";
 		private int m_timeout = 15; // default is 15 seconds
 		
 		public OleDbConnection ()
 		{
-			libgda.gda_init ("System.Data.OleDb", "0.1", 0, null);
-
-			/* initialize our GDA client */
-			m_gdaClient = libgda.gda_client_new ();
 		}
 
 		public OleDbConnection (string cnc_string) : this ()

+ 17 - 0
mcs/class/System.Data/System.Data.OleDb/libgda.cs

@@ -15,6 +15,23 @@ namespace System.Data.OleDb
 {
 	sealed internal class libgda
 	{
+		private static IntPtr m_gdaClient = IntPtr.Zero;
+		
+		static libgda ()
+		{
+			gda_init ("System.Data.OleDb", "0.1", 0, null);
+		}
+
+		public static IntPtr GdaClient
+		{
+			get {
+				if (m_gdaClient == IntPtr.Zero)
+					m_gdaClient = gda_client_new ();
+
+				return m_gdaClient;
+			}
+		}
+		
 		[DllImport("gda-2")]
 		public static extern void gda_init (string app_id,
 						    string version,