2002-05-29 Rodrigo Moya <rodrigo@ximian.com>
authorRodrigo Moya <rodrigo@mono-cvs.ximian.com>
Wed, 29 May 2002 18:48:37 +0000 (18:48 -0000)
committerRodrigo Moya <rodrigo@mono-cvs.ximian.com>
Wed, 29 May 2002 18:48:37 +0000 (18:48 -0000)
* 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

mcs/class/System.Data/System.Data.OleDb/ChangeLog
mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs
mcs/class/System.Data/System.Data.OleDb/libgda.cs

index 5451957092593534a03c66971279c946b7a05a2e..66dc185122e78272f4942f08367053f9fdd07229 100644 (file)
@@ -1,3 +1,12 @@
+2002-05-29  Rodrigo Moya <rodrigo@ximian.com>
+
+       * 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 <rodrigo@ximian.com>
 
        * libgda.cs: static class for libgda API calls.
index d87d78d1c0b46d554e9c5303c0ed502aebe102a5..33e9820366e388479cc6734d46096ab08b86b388 100644 (file)
@@ -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 ()
index 533eee9053c705d32aee13f318a411dccabfd8e8..4b454a3353c07df059b906ce2b8fabd902fd238b 100644 (file)
@@ -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,