libgda.cs 1.7 KB

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