2002-05-29 Rodrigo Moya <rodrigo@ximian.com>
[mono.git] / mcs / class / System.Data / System.Data.OleDb / libgda.cs
1 //
2 // System.Data.OleDb.libgda
3 //
4 // Author:
5 //   Rodrigo Moya (rodrigo@ximian.com)
6 //
7 // Copyright (C) Rodrigo Moya, 2002
8 //
9
10 using System.Data;
11 using System.Data.Common;
12 using System.Runtime.InteropServices;
13
14 namespace System.Data.OleDb
15 {
16         sealed internal class libgda
17         {
18                 private static IntPtr m_gdaClient = IntPtr.Zero;
19                 
20                 static libgda ()
21                 {
22                         gda_init ("System.Data.OleDb", "0.1", 0, null);
23                 }
24
25                 public static IntPtr GdaClient
26                 {
27                         get {
28                                 if (m_gdaClient == IntPtr.Zero)
29                                         m_gdaClient = gda_client_new ();
30
31                                 return m_gdaClient;
32                         }
33                 }
34                 
35                 [DllImport("gda-2")]
36                 public static extern void gda_init (string app_id,
37                                                     string version,
38                                                     int nargs,
39                                                     string[] args);
40
41                 [DllImport("gda-2")]
42                 public static extern IntPtr gda_client_new ();
43
44                 [DllImport("gda-2")]
45                 public static extern IntPtr gda_client_open_connection (IntPtr client,
46                                                                         string dsn,
47                                                                         string username,
48                                                                         string password);
49
50                 [DllImport("gda-2")]
51                 public static extern bool gda_connection_is_open (IntPtr cnc);
52                 
53                 [DllImport("gda-2")]
54                 public static extern bool gda_connection_close (IntPtr cnc);
55
56                 [DllImport("gda-2")]
57                 public static extern string gda_connection_get_database (IntPtr cnc);
58         }
59 }