SmiConnection.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //------------------------------------------------------------------------------
  2. // <copyright file="SmiConnection.cs" company="Microsoft">
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. // </copyright>
  5. // <owner current="true" primary="true">Microsoft</owner>
  6. // <owner current="true" primary="false">Microsoft</owner>
  7. //------------------------------------------------------------------------------
  8. namespace Microsoft.SqlServer.Server {
  9. using System;
  10. using System.Data;
  11. internal abstract class SmiConnection : IDisposable {
  12. //
  13. // Miscellaneous directives / accessors
  14. //
  15. internal abstract string GetCurrentDatabase(
  16. SmiEventSink eventSink
  17. );
  18. internal abstract void SetCurrentDatabase (
  19. string databaseName,
  20. SmiEventSink eventSink
  21. );
  22. //
  23. // IDisposable
  24. //
  25. public virtual void Dispose( ) {
  26. // Obsoleting from SMI -- use Close( SmiEventSink ) instead.
  27. // Intended to be removed (along with inheriting IDisposable) prior to RTM.
  28. // Implement body with throw because there are only a couple of ways to get to this code:
  29. // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-.
  30. // 2) Server didn't implement V2- on some interface and negotiated V2-.
  31. System.Data.Common.ADP.InternalError( System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod );
  32. }
  33. public virtual void Close(
  34. SmiEventSink eventSink
  35. ) {
  36. // Adding as of V3
  37. // Implement body with throw because there are only a couple of ways to get to this code:
  38. // 1) Client is calling this method even though the server negotiated for V2- and hasn't implemented V3 yet.
  39. // 2) Server didn't implement V3 on some interface, but negotiated V3+.
  40. System.Data.Common.ADP.InternalError( System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod );
  41. }
  42. //
  43. // Transaction API (should we encapsulate in it's own class or interface?)
  44. //
  45. internal abstract void BeginTransaction (
  46. string name,
  47. IsolationLevel level,
  48. SmiEventSink eventSink
  49. );
  50. internal abstract void CommitTransaction (
  51. long transactionId,
  52. SmiEventSink eventSink
  53. );
  54. internal abstract void CreateTransactionSavePoint (
  55. long transactionId,
  56. string name,
  57. SmiEventSink eventSink
  58. );
  59. internal abstract byte[] GetDTCAddress( // better buffer management needed? I.e. non-allocating call needed/possible?
  60. SmiEventSink eventSink
  61. );
  62. internal abstract void EnlistTransaction (
  63. byte[] token, // better buffer management needed? I.e. non-allocating call needed/possible?
  64. SmiEventSink eventSink
  65. );
  66. internal abstract byte[] PromoteTransaction ( // better buffer management needed? I.e. non-allocating call needed/possible?
  67. long transactionId,
  68. SmiEventSink eventSink
  69. );
  70. internal abstract void RollbackTransaction (
  71. long transactionId,
  72. string savePointName, // only roll back to save point if name non-null
  73. SmiEventSink eventSink
  74. );
  75. }
  76. }