OciServiceHandle.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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, IOciHandle, IDisposable
  21. {
  22. #region Fields
  23. OciSessionHandle sessionHandle;
  24. OciServerHandle serverHandle;
  25. OciErrorHandle errorHandle;
  26. #endregion // Fields
  27. #region Constructors
  28. public OciServiceHandle (OciEnvironmentHandle environment, IntPtr handle)
  29. : base (OciHandleType.Service, environment, handle)
  30. {
  31. }
  32. #endregion // Constructors
  33. #region Properties
  34. public OciErrorHandle ErrorHandle {
  35. get { return errorHandle; }
  36. set { errorHandle = value; }
  37. }
  38. #endregion // Properties
  39. #region Methods
  40. public void Dispose ()
  41. {
  42. Environment.FreeHandle (this);
  43. }
  44. public bool SetServer (OciServerHandle handle)
  45. {
  46. serverHandle = handle;
  47. int status = 0;
  48. status = OciGlue.OCIAttrSet (Handle,
  49. HandleType,
  50. serverHandle.Handle,
  51. 0,
  52. OciAttributeType.Server,
  53. errorHandle.Handle);
  54. return (status == 0);
  55. }
  56. public bool SetSession (OciSessionHandle handle)
  57. {
  58. sessionHandle = handle;
  59. int status = 0;
  60. status = OciGlue.OCIAttrSet (Handle,
  61. HandleType,
  62. sessionHandle.Handle,
  63. 0,
  64. OciAttributeType.Session,
  65. errorHandle.Handle);
  66. return (status == 0);
  67. }
  68. #endregion // Methods
  69. }
  70. }