SmiContext.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //------------------------------------------------------------------------------
  2. // <copyright file="SmiContext.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. using System.Data.Sql;
  12. using System.Data.SqlTypes;
  13. using System.Security.Principal;
  14. // NOTE: connection, transaction and context pipe operations could be
  15. // encapsulated in their own classes, and should if they get complex
  16. // (transaction is borderline at this point).
  17. internal abstract class SmiContext {
  18. internal abstract event EventHandler OutOfScope;
  19. internal abstract SmiConnection ContextConnection { get; }
  20. internal abstract long ContextTransactionId { get; }
  21. internal abstract System.Transactions.Transaction ContextTransaction { get; }
  22. internal abstract bool HasContextPipe { get; }
  23. internal abstract WindowsIdentity WindowsIdentity { get; }
  24. internal abstract SmiRecordBuffer CreateRecordBuffer (
  25. SmiExtendedMetaData[] columnMetaData, // Extended metadata because it requires names, udttypename and xmlschemaname ignored
  26. SmiEventSink eventSink
  27. );
  28. internal abstract SmiRequestExecutor CreateRequestExecutor (
  29. string commandText,
  30. CommandType commandType,
  31. SmiParameterMetaData[] parameterMetaData,
  32. SmiEventSink eventSink
  33. );
  34. //
  35. internal abstract object GetContextValue ( int key );
  36. internal abstract void GetTriggerInfo (
  37. SmiEventSink eventSink,
  38. out bool[] columnsUpdated,
  39. out TriggerAction action,
  40. out SqlXml eventInstanceData
  41. );
  42. internal abstract void SendMessageToPipe( string message, SmiEventSink eventSink );
  43. internal abstract void SendResultsStartToPipe( SmiRecordBuffer recordBuffer, SmiEventSink eventSink );
  44. internal abstract void SendResultsRowToPipe( SmiRecordBuffer recordBuffer, SmiEventSink eventSink );
  45. internal abstract void SendResultsEndToPipe( SmiRecordBuffer recordBuffer, SmiEventSink eventSink );
  46. internal abstract void SetContextValue ( int key, object value );
  47. // Scratch LOB storage region
  48. internal virtual SmiStream GetScratchStream( SmiEventSink sink ) {
  49. // Adding as of V3
  50. // Implement body with throw because there are only a couple of ways to get to this code:
  51. // 1) Client is calling this method even though the server negotiated for V2- and hasn't implemented V3 yet.
  52. // 2) Server didn't implement V3, but negotiated V3+.
  53. System.Data.Common.ADP.InternalError( System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod );
  54. return null;
  55. }
  56. }
  57. }