OciServiceHandle.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // OciServiceHandle.cs
  3. //
  4. // Part of managed C#/.NET library System.Data.OracleClient.dll
  5. //
  6. // Part of the Mono class libraries at
  7. // mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci
  8. //
  9. // Assembly: System.Data.OracleClient.dll
  10. // Namespace: System.Data.OracleClient.Oci
  11. //
  12. // Author:
  13. // Tim Coleman <[email protected]>
  14. //
  15. // Copyright (C) Tim Coleman, 2003
  16. //
  17. using System;
  18. using System.Runtime.InteropServices;
  19. namespace System.Data.OracleClient.Oci {
  20. internal sealed class OciServiceHandle : OciHandle
  21. {
  22. #region Fields
  23. bool disposed = false;
  24. OciSessionHandle session;
  25. OciServerHandle server;
  26. OciErrorHandle errorHandle;
  27. #endregion // Fields
  28. #region Constructors
  29. public OciServiceHandle (OciHandle parent, IntPtr handle)
  30. : base (OciHandleType.Service, parent, handle)
  31. {
  32. }
  33. #endregion // Constructors
  34. #region Properties
  35. public OciErrorHandle ErrorHandle {
  36. get { return errorHandle; }
  37. set { errorHandle = value; }
  38. }
  39. #endregion // Properties
  40. #region Methods
  41. protected override void Dispose (bool disposing)
  42. {
  43. if (!disposed) {
  44. try {
  45. if (disposing) {
  46. //if (server != null)
  47. // server.Dispose ();
  48. //if (session != null)
  49. // session.Dispose ();
  50. }
  51. disposed = true;
  52. } finally {
  53. base.Dispose (disposing);
  54. }
  55. }
  56. }
  57. public bool SetServer (OciServerHandle handle)
  58. {
  59. server = handle;
  60. int status = OciCalls.OCIAttrSet (this,
  61. HandleType,
  62. server,
  63. 0,
  64. OciAttributeType.Server,
  65. ErrorHandle);
  66. return (status == 0);
  67. }
  68. public bool SetSession (OciSessionHandle handle)
  69. {
  70. session = handle;
  71. int status = OciCalls.OCIAttrSet (this,
  72. HandleType,
  73. session,
  74. 0,
  75. OciAttributeType.Session,
  76. ErrorHandle);
  77. return (status == 0);
  78. }
  79. #endregion // Methods
  80. }
  81. }