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