* 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
+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.
{
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 ()
{
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,