From 6164633e090d567b932cc9449606668699a5a70e Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Thu, 1 May 2025 17:28:28 -0500 Subject: [PATCH 01/12] Move SmiConnection.cs to SmiConnection.netfx.cs in common project --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 4 +- .../Data/SqlClient/Server/SmiConnection.cs | 99 ------------------- .../SqlClient/Server/SmiConnection.netfx.cs | 67 +++++++++++++ 3 files changed, 70 insertions(+), 100 deletions(-) delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiConnection.cs create mode 100644 src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiConnection.netfx.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 8b8bda848e..e99accb748 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -519,6 +519,9 @@ Microsoft\Data\SqlClient\Server\MetadataUtilsSmi.cs + + Microsoft\Data\SqlClient\Server\SmiConnection.netfx.cs + Microsoft\Data\SqlClient\Server\SmiEventSink.cs @@ -893,7 +896,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiConnection.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiConnection.cs deleted file mode 100644 index bf04a3a23f..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiConnection.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Data; - -namespace Microsoft.Data.SqlClient.Server -{ - - internal abstract class SmiConnection : IDisposable - { - - // - // Miscellaneous directives / accessors - // - - internal abstract string GetCurrentDatabase( - SmiEventSink eventSink - ); - - internal abstract void SetCurrentDatabase( - string databaseName, - SmiEventSink eventSink - ); - - // - // IDisposable - // - public virtual void Dispose() - { - // Obsoleting from SMI -- use Close( SmiEventSink ) instead. - // Intended to be removed (along with inheriting IDisposable) prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void Close( - SmiEventSink eventSink - ) - { - // Adding as of V3 - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V2- and hasn't implemented V3 yet. - // 2) Server didn't implement V3 on some interface, but negotiated V3+. - Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - - // - // Transaction API (should we encapsulate in it's own class or interface?) - // - internal abstract void BeginTransaction( - string name, - IsolationLevel level, - SmiEventSink eventSink - ); - - internal abstract void CommitTransaction( - long transactionId, - SmiEventSink eventSink - ); - - internal abstract void CreateTransactionSavePoint( - long transactionId, - string name, - SmiEventSink eventSink - ); - - internal abstract byte[] GetDTCAddress( // better buffer management needed? I.e. non-allocating call needed/possible? - SmiEventSink eventSink - ); - - internal abstract void EnlistTransaction( - byte[] token, // better buffer management needed? I.e. non-allocating call needed/possible? - SmiEventSink eventSink - ); - - internal abstract byte[] PromoteTransaction( // better buffer management needed? I.e. non-allocating call needed/possible? - long transactionId, - SmiEventSink eventSink - ); - - internal abstract void RollbackTransaction( - long transactionId, - string savePointName, // only roll back to save point if name non-null - SmiEventSink eventSink - ); - - } -} - - - - diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiConnection.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiConnection.netfx.cs new file mode 100644 index 0000000000..ec9ad6e0ac --- /dev/null +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiConnection.netfx.cs @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#if NETFRAMEWORK + +using System; +using System.Data; + +namespace Microsoft.Data.SqlClient.Server +{ + + internal abstract class SmiConnection : IDisposable + { + + // + // Miscellaneous directives / accessors + // + internal abstract string GetCurrentDatabase(SmiEventSink eventSink); + + internal abstract void SetCurrentDatabase(string databaseName, SmiEventSink eventSink); + + // + // IDisposable + // + public virtual void Dispose() + { + // Obsoleting from SMI -- use Close( SmiEventSink ) instead. + // Intended to be removed (along with inheriting IDisposable) prior to RTM. + + // Implement body with throw because there are only a couple of ways to get to this code: + // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. + // 2) Server didn't implement V2- on some interface and negotiated V2-. + Common.ADP.InternalError(Common.ADP.InternalErrorCode.UnimplementedSMIMethod); + } + + public virtual void Close(SmiEventSink eventSink) + { + // Adding as of V3 + + // Implement body with throw because there are only a couple of ways to get to this code: + // 1) Client is calling this method even though the server negotiated for V2- and hasn't implemented V3 yet. + // 2) Server didn't implement V3 on some interface, but negotiated V3+. + Common.ADP.InternalError(Common.ADP.InternalErrorCode.UnimplementedSMIMethod); + } + + // + // Transaction API + // + internal abstract void BeginTransaction(string name, IsolationLevel level, SmiEventSink eventSink); + + internal abstract void CommitTransaction(long transactionId, SmiEventSink eventSink); + + internal abstract void CreateTransactionSavePoint(long transactionId, string name, SmiEventSink eventSink); + + internal abstract byte[] GetDTCAddress(SmiEventSink eventSink); + + internal abstract void EnlistTransaction(byte[] token, SmiEventSink eventSink); + + internal abstract byte[] PromoteTransaction(long transactionId, SmiEventSink eventSink); + + internal abstract void RollbackTransaction(long transactionId, string savePointName, SmiEventSink eventSink); + + } +} + +#endif From c4a56fd9c66b50646f20a566477aba163daee750 Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Thu, 1 May 2025 17:33:54 -0500 Subject: [PATCH 02/12] Move SmiContext.cs to SmiContext.netfx.cs in common project --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 4 +++- .../Microsoft/Data/SqlClient/Server/SmiContext.netfx.cs} | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) rename src/Microsoft.Data.SqlClient/{netfx/src/Microsoft/Data/SqlClient/Server/SmiContext.cs => src/Microsoft/Data/SqlClient/Server/SmiContext.netfx.cs} (95%) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index e99accb748..26f7b1e69d 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -522,6 +522,9 @@ Microsoft\Data\SqlClient\Server\SmiConnection.netfx.cs + + Microsoft\Data\SqlClient\Server\SmiContext.netfx.cs + Microsoft\Data\SqlClient\Server\SmiEventSink.cs @@ -896,7 +899,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiContext.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiContext.netfx.cs similarity index 95% rename from src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiContext.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiContext.netfx.cs index efdb16e287..1f2ef3031a 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiContext.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiContext.netfx.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETFRAMEWORK + using System; using System.Data; using System.Data.SqlTypes; @@ -40,8 +42,6 @@ internal abstract SmiRequestExecutor CreateRequestExecutor( SmiEventSink eventSink ); - // TODO: Consider making ContextConnection, TransactionId and TriggerInfo simply objects you get from the context. - internal abstract object GetContextValue(int key); internal abstract void GetTriggerInfo( @@ -75,3 +75,4 @@ internal virtual SmiStream GetScratchStream(SmiEventSink sink) } } +#endif From 452c62f57e0d9877cbd9da0babc345cb0389a3bd Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Thu, 1 May 2025 17:40:17 -0500 Subject: [PATCH 03/12] Move SmiContextFactory.cs to SmiContextFactory.netfx.cs in common project, some very light cleanup --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 4 +- .../Server/SmiContextFactory.netfx.cs} | 37 +++++++++---------- 2 files changed, 21 insertions(+), 20 deletions(-) rename src/Microsoft.Data.SqlClient/{netfx/src/Microsoft/Data/SqlClient/Server/SmiContextFactory.cs => src/Microsoft/Data/SqlClient/Server/SmiContextFactory.netfx.cs} (77%) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 26f7b1e69d..00c8865480 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -525,6 +525,9 @@ Microsoft\Data\SqlClient\Server\SmiContext.netfx.cs + + Microsoft\Data\SqlClient\Server\SmiContextFactory.netfx.cs + Microsoft\Data\SqlClient\Server\SmiEventSink.cs @@ -899,7 +902,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiContextFactory.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiContextFactory.netfx.cs similarity index 77% rename from src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiContextFactory.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiContextFactory.netfx.cs index 820c9c1bd2..f3d5fc0e31 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiContextFactory.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiContextFactory.netfx.cs @@ -2,21 +2,20 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETFRAMEWORK + using System; using System.Diagnostics; +using System.Security.Permissions; namespace Microsoft.Data.SqlClient.Server { - - sealed internal class SmiContextFactory + internal sealed class SmiContextFactory { public static readonly SmiContextFactory Instance = new SmiContextFactory(); private readonly SmiLink _smiLink; private readonly ulong _negotiatedSmiVersion; - private readonly byte _majorVersion; - private readonly byte _minorVersion; - private readonly short _buildNum; private readonly string _serverVersion; private readonly SmiEventSink_Default _eventSinkForGetCurrentContext; @@ -24,7 +23,7 @@ sealed internal class SmiContextFactory internal const ulong Sql2008Version = 210; internal const ulong LatestVersion = Sql2008Version; - private readonly ulong[] __supportedSmiVersions = new ulong[] { Sql2005Version, Sql2008Version }; + private readonly ulong[] _supportedSmiVersions = { Sql2005Version, Sql2008Version }; // Used as the key for SmiContext.GetContextValue() internal enum ContextKey @@ -33,7 +32,6 @@ internal enum ContextKey SqlContext = 1 } - private SmiContextFactory() { if (InOutOfProcHelper.InProc) @@ -60,22 +58,23 @@ private SmiContextFactory() System.Reflection.FieldInfo buildVersionField = GetStaticField(smiLinkType, "BuildVersion"); if (buildVersionField != null) { - UInt32 buildVersion = (UInt32)GetValue(buildVersionField); + uint buildVersion = (uint)GetValue(buildVersionField); - _majorVersion = (byte)(buildVersion >> 24); - _minorVersion = (byte)((buildVersion >> 16) & 0xff); - _buildNum = (short)(buildVersion & 0xffff); - _serverVersion = (String.Format((IFormatProvider)null, "{0:00}.{1:00}.{2:0000}", _majorVersion, (short)_minorVersion, _buildNum)); + byte majorVersion = (byte)(buildVersion >> 24); + byte minorVersion = (byte)((buildVersion >> 16) & 0xff); + short buildNum = (short)(buildVersion & 0xffff); + _serverVersion = string.Format(null, "{0:00}.{1:00}.{2:0000}", majorVersion, (short)minorVersion, buildNum); } else { - _serverVersion = String.Empty; // default value if nothing exists. + _serverVersion = string.Empty; // default value if nothing exists. } + _negotiatedSmiVersion = _smiLink.NegotiateVersion(SmiLink.InterfaceVersion); bool isSupportedVersion = false; - for (int i = 0; !isSupportedVersion && i < __supportedSmiVersions.Length; i++) + for (int i = 0; !isSupportedVersion && i < _supportedSmiVersions.Length; i++) { - if (__supportedSmiVersions[i] == _negotiatedSmiVersion) + if (_supportedSmiVersions[i] == _negotiatedSmiVersion) { isSupportedVersion = true; } @@ -132,24 +131,24 @@ internal SmiContext GetCurrentContext() throw SQL.ContextUnavailableWhileInProc(); } - Debug.Assert(typeof(SmiContext).IsInstanceOfType(result), "didn't get SmiContext from GetCurrentContext?"); + Debug.Assert(result is SmiContext, "didn't get SmiContext from GetCurrentContext?"); return (SmiContext)result; } - [System.Security.Permissions.ReflectionPermission(System.Security.Permissions.SecurityAction.Assert, MemberAccess = true)] + [ReflectionPermission(SecurityAction.Assert, MemberAccess = true)] private object GetValue(System.Reflection.FieldInfo fieldInfo) { object result = fieldInfo.GetValue(null); return result; } - [System.Security.Permissions.ReflectionPermission(System.Security.Permissions.SecurityAction.Assert, MemberAccess = true)] + [ReflectionPermission(SecurityAction.Assert, MemberAccess = true)] private System.Reflection.FieldInfo GetStaticField(Type aType, string fieldName) { System.Reflection.FieldInfo result = aType.GetField(fieldName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.GetField); return result; } - } } +#endif From 8fe773c34b51a45af7fcef3f930520220991c680 Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Thu, 1 May 2025 17:53:12 -0500 Subject: [PATCH 04/12] Moving SmiEventSink_DeferedProcessing.cs to SmiEventSink_DeferredProcessing.netfx.cs --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 5 +++-- .../Server/SmiEventSink_DeferredProcessing.netfx.cs} | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) rename src/Microsoft.Data.SqlClient/{netfx/src/Microsoft/Data/SqlClient/Server/SmiEventSink_DeferedProcessing.cs => src/Microsoft/Data/SqlClient/Server/SmiEventSink_DeferredProcessing.netfx.cs} (91%) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 00c8865480..139eab5914 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -537,6 +537,9 @@ Microsoft\Data\SqlClient\Server\SmiEventSink_Default.netfx.cs + + Microsoft\Data\SqlClient\Server\SmiEventSink_DeferredProcessing.netfx.cs + Microsoft\Data\SqlClient\Server\SmiGettersStream.cs @@ -902,8 +905,6 @@ - - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiEventSink_DeferedProcessing.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiEventSink_DeferredProcessing.netfx.cs similarity index 91% rename from src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiEventSink_DeferedProcessing.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiEventSink_DeferredProcessing.netfx.cs index c777fd470e..71ddaec1dc 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiEventSink_DeferedProcessing.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiEventSink_DeferredProcessing.netfx.cs @@ -2,9 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETFRAMEWORK + namespace Microsoft.Data.SqlClient.Server { - // This class exists purely to defer processing of messages until a later time. // It is designed to allow calling common code that interacts with the SMI layers // without throwing or otherwise processing messages in the sink until later on. @@ -23,9 +24,9 @@ namespace Microsoft.Data.SqlClient.Server // // IMPORTANT: Code that uses the DeferedProccess event sink is responsible for ensuring that // these messages ARE processed at some point. - internal class SmiEventSink_DeferedProcessing : SmiEventSink_Default + internal class SmiEventSink_DeferredProcessing : SmiEventSink_Default { - internal SmiEventSink_DeferedProcessing(SmiEventSink parent) : base(parent) + internal SmiEventSink_DeferredProcessing(SmiEventSink parent) : base(parent) { } @@ -37,3 +38,4 @@ protected override void DispatchMessages(bool ignoreNonFatalMessages) } } +#endif From ea7b6e11fe7725dc3a78708106dfb70128826aea Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Thu, 1 May 2025 17:54:41 -0500 Subject: [PATCH 05/12] Move SmiEventStream.cs to SmiEventStream.netfx.cs, make dispose obsolete --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 3 +++ .../Data/SqlClient/Server/SmiEventStream.netfx.cs} | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) rename src/Microsoft.Data.SqlClient/{netfx/src/Microsoft/Data/SqlClient/Server/SmiEventStream.cs => src/Microsoft/Data/SqlClient/Server/SmiEventStream.netfx.cs} (86%) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 139eab5914..a15bb3fa3b 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -540,6 +540,9 @@ Microsoft\Data\SqlClient\Server\SmiEventSink_DeferredProcessing.netfx.cs + + Microsoft\Data\SqlClient\Server\SmiEventStream.netfx.cs + Microsoft\Data\SqlClient\Server\SmiGettersStream.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiEventStream.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiEventStream.netfx.cs similarity index 86% rename from src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiEventStream.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiEventStream.netfx.cs index 1aab8871f2..91d0bd798f 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiEventStream.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiEventStream.netfx.cs @@ -2,17 +2,19 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETFRAMEWORK + using System; namespace Microsoft.Data.SqlClient.Server { internal abstract class SmiEventStream : IDisposable { - internal abstract bool HasEvents { get; } internal abstract void Close(SmiEventSink sink); + [Obsolete("Use Close instead.")] public virtual void Dispose() { // Obsoleting from SMI -- use Close instead. @@ -21,9 +23,11 @@ public virtual void Dispose() // Implement body with throw because there are only a couple of ways to get to this code: // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. // 2) Server didn't implement V2- on some interface and negotiated V2-. - Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); + Common.ADP.InternalError(Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } internal abstract void ProcessEvent(SmiEventSink sink); } } + +#endif From 7bec40f7d25c6c214b458d2a876c69c391921048 Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Thu, 1 May 2025 18:01:18 -0500 Subject: [PATCH 06/12] Moving SmiExecuteType.cs to SmiExecuteType.netfx.cs in common project --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 4 +++- .../Data/SqlClient/Server/SmiExecuteType.netfx.cs} | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) rename src/Microsoft.Data.SqlClient/{netfx/src/Microsoft/Data/SqlClient/Server/SmiExecuteType.cs => src/Microsoft/Data/SqlClient/Server/SmiExecuteType.netfx.cs} (81%) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index a15bb3fa3b..fd68e9efa7 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -543,6 +543,9 @@ Microsoft\Data\SqlClient\Server\SmiEventStream.netfx.cs + + Microsoft\Data\SqlClient\Server\SmiExecuteType.netfx.cs + Microsoft\Data\SqlClient\Server\SmiGettersStream.cs @@ -908,7 +911,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiExecuteType.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiExecuteType.netfx.cs similarity index 81% rename from src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiExecuteType.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiExecuteType.netfx.cs index 70bb5b3b99..8d44f01ecd 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiExecuteType.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiExecuteType.netfx.cs @@ -2,10 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETFRAMEWORK + namespace Microsoft.Data.SqlClient.Server { - - // enum representing the type of execution requested + // Enum representing the type of execution requested internal enum SmiExecuteType { NonQuery = 0, @@ -14,3 +15,4 @@ internal enum SmiExecuteType } } +#endif From aca62b9af82cb11cc2a7f617e9f8fbd44121221a Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Thu, 1 May 2025 18:05:48 -0500 Subject: [PATCH 07/12] Move SmiLink.cs to SmiLink.netfx.cs in common project --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 6 ++++-- .../Microsoft/Data/SqlClient/Server/SmiLink.netfx.cs} | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) rename src/Microsoft.Data.SqlClient/{netfx/src/Microsoft/Data/SqlClient/Server/SmiLink.cs => src/Microsoft/Data/SqlClient/Server/SmiLink.netfx.cs} (98%) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index fd68e9efa7..30971aad3c 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -543,12 +543,15 @@ Microsoft\Data\SqlClient\Server\SmiEventStream.netfx.cs - + Microsoft\Data\SqlClient\Server\SmiExecuteType.netfx.cs Microsoft\Data\SqlClient\Server\SmiGettersStream.cs + + Microsoft\Data\SqlClient\Server\SmiLink.netfx.cs + Microsoft\Data\SqlClient\Server\SmiMetaData.cs @@ -911,7 +914,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiLink.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiLink.netfx.cs similarity index 98% rename from src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiLink.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiLink.netfx.cs index cda6937ec0..fbe4211359 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiLink.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiLink.netfx.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETFRAMEWORK + [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("SqlAccess, PublicKey=0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")] // SQLBU 437687 namespace Microsoft.Data.SqlClient.Server @@ -27,3 +29,5 @@ internal abstract class SmiLink internal abstract object GetCurrentContext(SmiEventSink eventSink); } } + +#endif From cde28dca9c2e6eccee906414b4b648a1b8b1a419 Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Thu, 1 May 2025 18:19:40 -0500 Subject: [PATCH 08/12] Moving SmiRequestExecutor.cs to SmiRequestExecutor.netfx.cs in common project, Removing obsolete code --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 4 +- .../SqlClient/Server/SmiRequestExecutor.cs | 940 ------------------ .../Server/SmiRequestExecutor.netfx.cs | 57 ++ 3 files changed, 60 insertions(+), 941 deletions(-) delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.cs create mode 100644 src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.netfx.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 30971aad3c..6d9a6b52f2 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -561,6 +561,9 @@ Microsoft\Data\SqlClient\Server\SmiRecordBuffer.cs + + Microsoft\Data\SqlClient\Server\SmiRequestExecutor.netfx.cs + Microsoft\Data\SqlClient\Server\SmiSettersStream.cs @@ -914,7 +917,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.cs deleted file mode 100644 index ed9754447d..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.cs +++ /dev/null @@ -1,940 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Data; -using System.Data.SqlTypes; -using System.Transactions; - -namespace Microsoft.Data.SqlClient.Server -{ - - internal abstract class SmiRequestExecutor : SmiTypedGetterSetter, ITypedSettersV3, ITypedSetters, ITypedGetters, IDisposable - { - - #region SMI active methods as of V210 - - #region Overall control methods - public virtual void Close( - SmiEventSink eventSink - ) - { - // Adding as of V3 - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V2- and hasn't implemented V3 yet. - // 2) Server didn't implement V3 on some interface, but negotiated V3+. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - internal virtual SmiEventStream Execute( - SmiConnection connection, // Assigned connection - long transactionId, // Assigned transaction - Transaction associatedTransaction, // SysTx transaction associated with request, if any. - CommandBehavior behavior, // CommandBehavior, - SmiExecuteType executeType // Type of execute called (NonQuery/Pipe/Reader/Row, etc) - ) - { - // Adding as of V210 - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V200- and hasn't implemented V210 yet. - // 2) Server didn't implement V210 on some interface, but negotiated V210+. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - #endregion - - #region Supported access method types (Get] vs. Set) - - // RequestExecutor only supports setting parameter values, not getting - internal override bool CanGet - { - get - { - return false; - } - } - - internal override bool CanSet - { - get - { - return true; - } - } - - #endregion - - // SmiRequestExecutor and it's subclasses should NOT override Getters from SmiTypedGetterSetter - // Calls against those methods on a Request Executor are not allowed. - - #region Value setters - - // Set DEFAULT bit for parameter - internal abstract void SetDefault(int ordinal); - - // SmiRequestExecutor subclasses must implement all Setters from SmiTypedGetterSetter - // SmiRequestExecutor itself does not need to implement these, since it inherits the default implementation from - // SmiTypedGetterSetter - - #endregion - #endregion - - #region Obsolete as of V210 - internal virtual SmiEventStream Execute( - SmiConnection connection, // Assigned connection - long transactionId, // Assigned transaction - CommandBehavior behavior, // CommandBehavior, - SmiExecuteType executeType // Type of execute called (NonQuery/Pipe/Reader/Row, etc) - ) - { - // Obsoleting as of V210 - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V210+ (and doesn't implement it). - // 2) Server doesn't implement this method, but negotiated V200-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - #endregion - - #region OBSOLETE STUFF that never shipped without obsolete attribute - - // - // IDisposable - // - public virtual void Dispose() - { - // ******** OBSOLETING from SMI -- use close instead. - // Intended to be removed (along with removing inheriting IDisposable) prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - // Check to see if parameter's DEFAULT bit is set - internal virtual bool IsSetAsDefault(int ordinal) - { - // ******** OBSOLETING from SMI -- Not needed. - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - // Get the count of parameters - public virtual int Count - { - get - { - // ******** OBSOLETING from SMI -- front end needs to keep track of input param metadata itself. Outparam metadata comes with ParametersAvailable event. - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - } - - // Get the meta data associated with the parameter. - public virtual SmiParameterMetaData GetMetaData(int ordinal) - { - // ******** OBSOLETING from SMI -- front end needs to keep track of input param metadata itself. Outparam metadata comes with ParametersAvailable event. - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - // - // ITypedGetters methods (for output parameters) (OBSOLETE) - // - public virtual bool IsDBNull(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlDbType GetVariantType(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Boolean GetBoolean(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Byte GetByte(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual long GetBytes(int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Char GetChar(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual long GetChars(int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Int16 GetInt16(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Int32 GetInt32(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Int64 GetInt64(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Single GetFloat(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Double GetDouble(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual String GetString(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Decimal GetDecimal(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual DateTime GetDateTime(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual Guid GetGuid(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlBoolean GetSqlBoolean(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlByte GetSqlByte(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlInt16 GetSqlInt16(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlInt32 GetSqlInt32(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlInt64 GetSqlInt64(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlSingle GetSqlSingle(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlDouble GetSqlDouble(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlMoney GetSqlMoney(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlDateTime GetSqlDateTime(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlDecimal GetSqlDecimal(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlString GetSqlString(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlBinary GetSqlBinary(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlGuid GetSqlGuid(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlChars GetSqlChars(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlBytes GetSqlBytes(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlXml GetSqlXml(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlXml GetSqlXmlRef(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlBytes GetSqlBytesRef(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual SqlChars GetSqlCharsRef(int ordinal) - { - // ******** OBSOLETING from SMI -- use ITypedGettersV3 in ParametersAvailable event instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - // - // ITypedSetters methods - // - public virtual void SetDBNull(int ordinal) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetBoolean(int ordinal, Boolean value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetByte(int ordinal, Byte value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetBytes(int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetChar(int ordinal, char value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetChars(int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetInt16(int ordinal, Int16 value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetInt32(int ordinal, Int32 value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetInt64(int ordinal, Int64 value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetFloat(int ordinal, Single value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetDouble(int ordinal, Double value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetString(int ordinal, string value) - { - // Implemented as virtual method to allow transport to remove it's implementation - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V2 and dropped support for V1. - // 2) Server didn't implement V1 on some interface and negotiated V1. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetString(int ordinal, string value, int offset) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetDecimal(int ordinal, Decimal value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetDateTime(int ordinal, DateTime value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetGuid(int ordinal, Guid value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlBoolean(int ordinal, SqlBoolean value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlByte(int ordinal, SqlByte value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlInt16(int ordinal, SqlInt16 value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlInt32(int ordinal, SqlInt32 value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlInt64(int ordinal, SqlInt64 value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlSingle(int ordinal, SqlSingle value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlDouble(int ordinal, SqlDouble value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlMoney(int ordinal, SqlMoney value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlDateTime(int ordinal, SqlDateTime value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlDecimal(int ordinal, SqlDecimal value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlString(int ordinal, SqlString value) - { - // Implemented as empty virtual method to allow transport to remove it's implementation - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V2 and dropped support for V1. - // 2) Server didn't implement V1 on some interface and negotiated V1. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlString(int ordinal, SqlString value, int offset) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlBinary(int ordinal, SqlBinary value) - { - // Implemented as empty virtual method to allow transport to remove it's implementation - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V2 and dropped support for V1. - // 2) Server didn't implement V1 on some interface and negotiated V1. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlBinary(int ordinal, SqlBinary value, int offset) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlGuid(int ordinal, SqlGuid value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlChars(int ordinal, SqlChars value) - { - // Implemented as empty virtual method to allow transport to remove it's implementation - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V2 and dropped support for V1. - // 2) Server didn't implement V1 on some interface and negotiated V1. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlChars(int ordinal, SqlChars value, int offset) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlBytes(int ordinal, SqlBytes value) - { - // Implemented as empty virtual method to allow transport to remove it's implementation - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V2 and dropped support for V1. - // 2) Server didn't implement V1 on some interface and negotiated V1. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlBytes(int ordinal, SqlBytes value, int offset) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - - public virtual void SetSqlXml(int ordinal, SqlXml value) - { - // ******** OBSOLETING from SMI -- use related ITypedSettersV3 method instead - // Intended to be removed prior to RTM. - - // Implement body with throw because there are only a couple of ways to get to this code: - // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. - // 2) Server didn't implement V2- on some interface and negotiated V2-. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); - } - #endregion - } -} diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.netfx.cs new file mode 100644 index 0000000000..45a9db186e --- /dev/null +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.netfx.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#if NETFRAMEWORK + +using System.Data; +using System.Transactions; + +namespace Microsoft.Data.SqlClient.Server +{ + internal abstract class SmiRequestExecutor : SmiTypedGetterSetter + { + public virtual void Close(SmiEventSink eventSink) + { + // Adding as of V3 + + // Implement body with throw because there are only a couple of ways to get to this code: + // 1) Client is calling this method even though the server negotiated for V2- and hasn't implemented V3 yet. + // 2) Server didn't implement V3 on some interface, but negotiated V3+. + throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); + } + + internal virtual SmiEventStream Execute( + SmiConnection connection, // Assigned connection + long transactionId, // Assigned transaction + Transaction associatedTransaction, // SysTx transaction associated with request, if any. + CommandBehavior behavior, // CommandBehavior, + SmiExecuteType executeType // Type of execute called (NonQuery/Pipe/Reader/Row, etc) + ) + { + // Adding as of V210 + + // Implement body with throw because there are only a couple of ways to get to this code: + // 1) Client is calling this method even though the server negotiated for V200- and hasn't implemented V210 yet. + // 2) Server didn't implement V210 on some interface, but negotiated V210+. + throw Common.ADP.InternalError(Common.ADP.InternalErrorCode.UnimplementedSMIMethod); + } + + // RequestExecutor only supports setting parameter values, not getting + internal override bool CanGet => false; + + internal override bool CanSet => true; + + // SmiRequestExecutor and it's subclasses should NOT override Getters from SmiTypedGetterSetter + // Calls against those methods on a Request Executor are not allowed. + + // Set DEFAULT bit for parameter + internal abstract void SetDefault(int ordinal); + + // SmiRequestExecutor subclasses must implement all Setters from SmiTypedGetterSetter + // SmiRequestExecutor itself does not need to implement these, since it inherits the default implementation from + // SmiTypedGetterSetter + } +} + +#endif From 09653f3254037bc7f3d890b8aefa288bb2f4043c Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Thu, 1 May 2025 18:31:35 -0500 Subject: [PATCH 09/12] Moving SmiStream.cs to SmiStream.netfx.cs in common project --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 4 +++- .../Data/SqlClient/Server/SmiStream.netfx.cs} | 20 +++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-) rename src/Microsoft.Data.SqlClient/{netfx/src/Microsoft/Data/SqlClient/Server/SmiStream.cs => src/Microsoft/Data/SqlClient/Server/SmiStream.netfx.cs} (80%) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 6d9a6b52f2..7151b276d5 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -567,6 +567,9 @@ Microsoft\Data\SqlClient\Server\SmiSettersStream.cs + + Microsoft\Data\SqlClient\Server\SmiStream.netfx.cs + Microsoft\Data\SqlClient\Server\SmiTypedGetterSetter.cs @@ -917,7 +920,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiStream.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiStream.netfx.cs similarity index 80% rename from src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiStream.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiStream.netfx.cs index deed3b8f14..9774a3e828 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiStream.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiStream.netfx.cs @@ -2,29 +2,21 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// Stream-like object that uses SmiEventSink for server-side errors. +#if NETFRAMEWORK using System.IO; namespace Microsoft.Data.SqlClient.Server { + // Stream-like object that uses SmiEventSink for server-side errors. internal abstract class SmiStream { - public abstract bool CanRead - { - get; - } + public abstract bool CanRead { get; } // If CanSeek is false, Position, Seek, Length, and SetLength should throw. - public abstract bool CanSeek - { - get; - } + public abstract bool CanSeek { get; } - public abstract bool CanWrite - { - get; - } + public abstract bool CanWrite { get; } public abstract long GetLength(SmiEventSink sink); @@ -45,3 +37,5 @@ public abstract bool CanWrite } } + +#endif From 9e104ee7ec248158c7cb460c7bb6e7647f9b4e50 Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Fri, 2 May 2025 12:26:50 -0500 Subject: [PATCH 10/12] Merge SmiXetterAccessMap.cs into SmiXetterAccessMap.Common.cs and rename to SmiXetterAccessMap.cs --- .../src/Microsoft.Data.SqlClient.csproj | 4 +- .../netfx/src/Microsoft.Data.SqlClient.csproj | 4 +- .../SqlClient/Server/SmiXetterAccessMap.cs | 63 --------- .../Server/SmiXetterAccessMap.Common.cs | 105 --------------- .../SqlClient/Server/SmiXetterAccessMap.cs | 125 ++++++++++++++++++ 5 files changed, 129 insertions(+), 172 deletions(-) delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs delete mode 100644 src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.Common.cs create mode 100644 src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index f1c5c2d6e6..6b74891bb4 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -380,8 +380,8 @@ Microsoft\Data\SqlClient\Server\SmiTypedGetterSetter.cs - - Microsoft\Data\SqlClient\Server\SmiXetterAccessMap.Common.cs + + Microsoft\Data\SqlClient\Server\SmiXetterAccessMap.cs Microsoft\Data\SqlClient\Server\SmiXetterTypeCode.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 7151b276d5..5d3df89dbf 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -573,8 +573,8 @@ Microsoft\Data\SqlClient\Server\SmiTypedGetterSetter.cs - - Microsoft\Data\SqlClient\Server\SmiXetterAccess.Common.cs + + Microsoft\Data\SqlClient\Server\SmiXetterAccess.cs Microsoft\Data\SqlClient\Server\SmiXetterTypeCode.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs deleted file mode 100644 index a5b9f2004d..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace Microsoft.Data.SqlClient.Server -{ - - // Formal encoding of SMI's metadata-to-ITypedSetter/-from-ITypedGetter validity rules - internal partial class SmiXetterAccessMap - { - - private static bool[,] __isGetterAccessValid = { - // Getters as columns (abbreviated from XetterTypeCode names) - // SqlDbTypes as rows - // bool, byte, bytes, chars, strng, int16, int32, int64, singl, doubl, sqldec, date, guid, varmd, Xetr, time, dtost -/*BigInt*/ { _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Binary*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Bit*/ { X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Char*/ { _ , _ , X , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*DTime*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , }, -/*Decimal*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , }, -/*Float*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , }, -/*Image*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Int*/ { _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Money*/ { _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*NChar*/ { _ , _ , X , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*NText*/ { _ , _ , X , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*NVarChar*/{ _ , _ , X , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Real*/ { _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*UniqueId*/{ _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , }, -/*SmDTime*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , }, -/*SmInt*/ { _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*SmMoney*/ { _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Text*/ { _ , _ , X , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Tstamp*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*TinyInt*/ { _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*VarBin*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*VarChar*/ { _ , _ , X , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Variant*/ { X , X , X , X , X , X , X , X , X , X , X , X , X , X , _ , X , X , }, -/* 24 */ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Xml*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/* 26 */ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/* 27 */ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/* 28 */ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Udt*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, -/*Struct*/ { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , }, -/*Date*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , }, -/*Time*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , }, -/*DTime2*/ { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , }, -/*DTOffset*/{ _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , }, - }; - - internal static bool IsGetterAccessValid(SmiMetaData metaData, SmiXetterTypeCode xetterType) - { - // Make sure no-one adds a new xetter type without updating this file! - Debug.Assert(SmiXetterTypeCode.XetBoolean <= xetterType && SmiXetterTypeCode.XetDateTimeOffset >= xetterType); - - return __isGetterAccessValid[(int)metaData.SqlDbType, (int)xetterType]; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.Common.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.Common.cs deleted file mode 100644 index 8e0eb4baee..0000000000 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.Common.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace Microsoft.Data.SqlClient.Server -{ - /// - /// Formal encoding of SMI's metadata-to-ITypedSetter/-from-ITypedGetter validity rules - /// - internal partial class SmiXetterAccessMap - { - // A couple of private constants to make the getter/setter access tables more readable - private const bool X = true; - private const bool _ = false; - - private static bool[,] s_isSetterAccessValid = { - // Setters as columns (abbreviated from XetterTypeCode names) - // SqlDbTypes as rows - // Current difference between setters and getters is that character setters do - // not need to support SetBytes - // bool, byte, bytes, chars, strng, int16, int32, int64, singl, doubl, sqldec, date, guid, varmd, Xetr, time, dtost - /*BigInt*/ - { _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Binary*/ - { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Bit*/ - { X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Char*/ - { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*DTime*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , }, - /*Decimal*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , }, - /*Float*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , }, - /*Image*/ - { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Int*/ - { _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Money*/ - { _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*NChar*/ - { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*NText*/ - { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*NVarChar*/ - { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Real*/ - { _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*UniqueId*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , }, - /*SmDTime*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , }, - /*SmInt*/ - { _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*SmMoney*/ - { _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Text*/ - { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Tstamp*/ - { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*TinyInt*/ - { _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*VarBin*/ - { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*VarChar*/ - { _ , _ , _ , X , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Variant*/ - { X , X , X , X , X , X , X , X , X , X , X , X , X , X , _ , X , X , }, - /* 24 */ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Xml*/ - { _ , _ , X , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /* 26 */ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /* 27 */ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /* 28 */ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Udt*/ - { _ , _ , X , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , }, - /*Struct*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , }, - /*Date*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , }, - /*Time*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , }, - /*DTime2*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , _ , _ , _ , _ , _ , }, - /*DTOffset*/ - { _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , X , }, - }; - - internal static bool IsSetterAccessValid(SmiMetaData metaData, SmiXetterTypeCode xetterType) - { - // Make sure no-one adds a new xetter type without updating this file! - Debug.Assert(SmiXetterTypeCode.XetBoolean <= xetterType && SmiXetterTypeCode.XetDateTimeOffset >= xetterType && - SmiXetterTypeCode.GetVariantMetaData != xetterType); - - return s_isSetterAccessValid[(int)metaData.SqlDbType, (int)xetterType]; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs new file mode 100644 index 0000000000..add2ce89cd --- /dev/null +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterAccessMap.cs @@ -0,0 +1,125 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace Microsoft.Data.SqlClient.Server +{ + /// + /// Formal encoding of SMI's metadata-to-ITypedSetter/-from-ITypedGetter validity rules + /// + internal partial class SmiXetterAccessMap + { + // A couple of private constants to make the getter/setter access tables more readable + private const bool X = true; + private const bool _ = false; + + #if NETFRAMEWORK + private static readonly bool[,] s_isGetterAccessValid = + { + // Getters as columns (abbreviated from XetterTypeCode names) + // SqlDbTypes as rows + // bool, byte, bytes, chars, strng, int16, int32, int64, singl, doubl, sqldec, date, guid, varmd, Xetr, time, dtost + /*BigInt*/ { _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, }, + /*Binary*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Bit*/ { X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Char*/ { _, _, X, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*DTime*/ { _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, }, + /*Decimal*/ { _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, _, }, + /*Float*/ { _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, }, + /*Image*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Int*/ { _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, _, }, + /*Money*/ { _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, }, + /*NChar*/ { _, _, X, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*NText*/ { _, _, X, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*NVarChar*/ { _, _, X, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Real*/ { _, _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, }, + /*UniqueId*/ { _, _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, }, + /*SmDTime*/ { _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, }, + /*SmInt*/ { _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, _, _, }, + /*SmMoney*/ { _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, }, + /*Text*/ { _, _, X, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Tstamp*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*TinyInt*/ { _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*VarBin*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*VarChar*/ { _, _, X, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Variant*/ { X, X, X, X, X, X, X, X, X, X, X, X, X, X, _, X, X, }, + /* 24 */ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Xml*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /* 26 */ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /* 27 */ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /* 28 */ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Udt*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Struct*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, X, _, _, }, + /*Date*/ { _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, }, + /*Time*/ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X, _, }, + /*DTime2*/ { _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, }, + /*DTOffset*/ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X, }, + }; + #endif + + private static readonly bool[,] s_isSetterAccessValid = + { + // Setters as columns (abbreviated from XetterTypeCode names) + // SqlDbTypes as rows + // Current difference between setters and getters is that character setters do + // not need to support SetBytes + // bool, byte, bytes, chars, strng, int16, int32, int64, singl, doubl, sqldec, date, guid, varmd, Xetr, time, dtost + /*BigInt*/ { _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, }, + /*Binary*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Bit*/ { X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Char*/ { _, _, _, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*DTime*/ { _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, }, + /*Decimal*/ { _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, _, }, + /*Float*/ { _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, }, + /*Image*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Int*/ { _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, _, }, + /*Money*/ { _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, }, + /*NChar*/ { _, _, _, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*NText*/ { _, _, _, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*NVarChar*/ { _, _, _, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Real*/ { _, _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, }, + /*UniqueId*/ { _, _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, }, + /*SmDTime*/ { _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, }, + /*SmInt*/ { _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, _, _, }, + /*SmMoney*/ { _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _, }, + /*Text*/ { _, _, _, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Tstamp*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*TinyInt*/ { _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*VarBin*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*VarChar*/ { _, _, _, X, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Variant*/ { X, X, X, X, X, X, X, X, X, X, X, X, X, X, _, X, X, }, + /* 24 */ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Xml*/ { _, _, X, _, X, _, _, _, _, _, _, _, _, _, _, _, _, }, + /* 26 */ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /* 27 */ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /* 28 */ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Udt*/ { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, }, + /*Struct*/ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, X, _, _, }, + /*Date*/ { _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, }, + /*Time*/ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X, _, }, + /*DTime2*/ { _, _, _, _, _, _, _, _, _, _, _, X, _, _, _, _, _, }, + /*DTOffset*/ { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X, }, + }; + + #if NETFRAMEWORK + internal static bool IsGetterAccessValid(SmiMetaData metaData, SmiXetterTypeCode xetterType) + { + // Make sure no-one adds a new xetter type without updating this file! + Debug.Assert(SmiXetterTypeCode.XetBoolean <= xetterType && SmiXetterTypeCode.XetDateTimeOffset >= xetterType); + + return s_isGetterAccessValid[(int)metaData.SqlDbType, (int)xetterType]; + } + #endif + + internal static bool IsSetterAccessValid(SmiMetaData metaData, SmiXetterTypeCode xetterType) + { + // Make sure no-one adds a new xetter type without updating this file! + Debug.Assert(SmiXetterTypeCode.XetBoolean <= xetterType && SmiXetterTypeCode.XetDateTimeOffset >= xetterType && + SmiXetterTypeCode.GetVariantMetaData != xetterType); + + return s_isSetterAccessValid[(int)metaData.SqlDbType, (int)xetterType]; + } + } +} From b46660e132aceb8a42340a913ab919b7e8d50a14 Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Fri, 2 May 2025 13:06:54 -0500 Subject: [PATCH 11/12] Merge EMDEventType into TriggerAction, move TriggerAction.cs to TriggerAction.netfx.cs in common project --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 4 +- .../Data/SqlClient/Server/TriggerAction.cs | 266 ------------------ .../SqlClient/Server/TriggerAction.netfx.cs | 263 +++++++++++++++++ 3 files changed, 266 insertions(+), 267 deletions(-) delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/TriggerAction.cs create mode 100644 src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/TriggerAction.netfx.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 5d3df89dbf..efade84d07 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -594,6 +594,9 @@ Microsoft\Data\SqlClient\Server\SqlRecordBuffer.cs + + Microsoft\Data\SqlClient\Server\TriggerAction.netfx.cs + Microsoft\Data\SqlClient\Server\ValueUtilsSmi.cs @@ -920,7 +923,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/TriggerAction.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/TriggerAction.cs deleted file mode 100644 index 1f1b011ee1..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/TriggerAction.cs +++ /dev/null @@ -1,266 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Data.SqlClient.Server -{ - internal enum EMDEventType - { - x_eet_Invalid = 0, // Not actually a valid type: not persisted. - x_eet_Insert = 1, // Insert (eg. on table/view) - x_eet_Update = 2, // Update (eg. on table/view) - x_eet_Delete = 3, // Delete (eg. on table/view) - x_eet_Create_Table = 21, - x_eet_Alter_Table = 22, - x_eet_Drop_Table = 23, - x_eet_Create_Index = 24, - x_eet_Alter_Index = 25, - x_eet_Drop_Index = 26, - x_eet_Create_Stats = 27, - x_eet_Update_Stats = 28, - x_eet_Drop_Stats = 29, - x_eet_Create_Secexpr = 31, - x_eet_Drop_Secexpr = 33, - x_eet_Create_Synonym = 34, - x_eet_Drop_Synonym = 36, - x_eet_Create_View = 41, - x_eet_Alter_View = 42, - x_eet_Drop_View = 43, - x_eet_Create_Procedure = 51, - x_eet_Alter_Procedure = 52, - x_eet_Drop_Procedure = 53, - x_eet_Create_Function = 61, - x_eet_Alter_Function = 62, - x_eet_Drop_Function = 63, - x_eet_Create_Trigger = 71, // On database/server/table - x_eet_Alter_Trigger = 72, - x_eet_Drop_Trigger = 73, - x_eet_Create_Event_Notification = 74, - x_eet_Drop_Event_Notification = 76, - x_eet_Create_Type = 91, - // x_eet_Alter_Type = 92, - x_eet_Drop_Type = 93, - x_eet_Create_Assembly = 101, - x_eet_Alter_Assembly = 102, - x_eet_Drop_Assembly = 103, - x_eet_Create_User = 131, - x_eet_Alter_User = 132, - x_eet_Drop_User = 133, - x_eet_Create_Role = 134, - x_eet_Alter_Role = 135, - x_eet_Drop_Role = 136, - x_eet_Create_AppRole = 137, - x_eet_Alter_AppRole = 138, - x_eet_Drop_AppRole = 139, - x_eet_Create_Schema = 141, - x_eet_Alter_Schema = 142, - x_eet_Drop_Schema = 143, - x_eet_Create_Login = 144, - x_eet_Alter_Login = 145, - x_eet_Drop_Login = 146, - x_eet_Create_MsgType = 151, - x_eet_Alter_MsgType = 152, - x_eet_Drop_MsgType = 153, - x_eet_Create_Contract = 154, - x_eet_Alter_Contract = 155, - x_eet_Drop_Contract = 156, - x_eet_Create_Queue = 157, - x_eet_Alter_Queue = 158, - x_eet_Drop_Queue = 159, - x_eet_Create_Service = 161, - x_eet_Alter_Service = 162, - x_eet_Drop_Service = 163, - x_eet_Create_Route = 164, - x_eet_Alter_Route = 165, - x_eet_Drop_Route = 166, - x_eet_Grant_Statement = 167, - x_eet_Deny_Statement = 168, - x_eet_Revoke_Statement = 169, - x_eet_Grant_Object = 170, - x_eet_Deny_Object = 171, - x_eet_Revoke_Object = 172, - x_eet_Activation = 173, - x_eet_Create_Binding = 174, - x_eet_Alter_Binding = 175, - x_eet_Drop_Binding = 176, - x_eet_Create_XmlSchema = 177, - x_eet_Alter_XmlSchema = 178, - x_eet_Drop_XmlSchema = 179, - x_eet_Create_HttpEndpoint = 181, - x_eet_Alter_HttpEndpoint = 182, - x_eet_Drop_HttpEndpoint = 183, - x_eet_Create_Partition_Function = 191, - x_eet_Alter_Partition_Function = 192, - x_eet_Drop_Partition_Function = 193, - x_eet_Create_Partition_Scheme = 194, - x_eet_Alter_Partition_Scheme = 195, - x_eet_Drop_Partition_Scheme = 196, - - x_eet_Create_Database = 201, - x_eet_Alter_Database = 202, - x_eet_Drop_Database = 203, - - // 1000 - 1999 is reserved for SQLTrace. - x_eet_Trace_Start = 1000, - x_eet_Trace_End = 1999, - // WHEN ADDING, PLEASE CHECK WITH FILE-OWNER FOR WHICH NUMBERS TO USE. THANKS! - }; - - /// - public enum TriggerAction - { - /// - Invalid = EMDEventType.x_eet_Invalid, - /// - Insert = EMDEventType.x_eet_Insert, - /// - Update = EMDEventType.x_eet_Update, - /// - Delete = EMDEventType.x_eet_Delete, - /// - CreateTable = EMDEventType.x_eet_Create_Table, - /// - AlterTable = EMDEventType.x_eet_Alter_Table, - /// - DropTable = EMDEventType.x_eet_Drop_Table, - /// - CreateIndex = EMDEventType.x_eet_Create_Index, - /// - AlterIndex = EMDEventType.x_eet_Alter_Index, - /// - DropIndex = EMDEventType.x_eet_Drop_Index, - /// - CreateSynonym = EMDEventType.x_eet_Create_Synonym, - /// - DropSynonym = EMDEventType.x_eet_Drop_Synonym, - /// - CreateSecurityExpression = EMDEventType.x_eet_Create_Secexpr, - /// - DropSecurityExpression = EMDEventType.x_eet_Drop_Secexpr, - /// - CreateView = EMDEventType.x_eet_Create_View, - /// - AlterView = EMDEventType.x_eet_Alter_View, - /// - DropView = EMDEventType.x_eet_Drop_View, - /// - CreateProcedure = EMDEventType.x_eet_Create_Procedure, - /// - AlterProcedure = EMDEventType.x_eet_Alter_Procedure, - /// - DropProcedure = EMDEventType.x_eet_Drop_Procedure, - /// - CreateFunction = EMDEventType.x_eet_Create_Function, - /// - AlterFunction = EMDEventType.x_eet_Alter_Function, - /// - DropFunction = EMDEventType.x_eet_Drop_Function, - /// - CreateTrigger = EMDEventType.x_eet_Create_Trigger, - /// - AlterTrigger = EMDEventType.x_eet_Alter_Trigger, - /// - DropTrigger = EMDEventType.x_eet_Drop_Trigger, - /// - CreateEventNotification = EMDEventType.x_eet_Create_Event_Notification, - /// - DropEventNotification = EMDEventType.x_eet_Drop_Event_Notification, - /// - CreateType = EMDEventType.x_eet_Create_Type, - // Alter_Type = EMDEventType.x_eet_Alter_Type, - /// - DropType = EMDEventType.x_eet_Drop_Type, - /// - CreateAssembly = EMDEventType.x_eet_Create_Assembly, - /// - AlterAssembly = EMDEventType.x_eet_Alter_Assembly, - /// - DropAssembly = EMDEventType.x_eet_Drop_Assembly, - /// - CreateUser = EMDEventType.x_eet_Create_User, - /// - AlterUser = EMDEventType.x_eet_Alter_User, - /// - DropUser = EMDEventType.x_eet_Drop_User, - /// - CreateRole = EMDEventType.x_eet_Create_Role, - /// - AlterRole = EMDEventType.x_eet_Alter_Role, - /// - DropRole = EMDEventType.x_eet_Drop_Role, - /// - CreateAppRole = EMDEventType.x_eet_Create_AppRole, - /// - AlterAppRole = EMDEventType.x_eet_Alter_AppRole, - /// - DropAppRole = EMDEventType.x_eet_Drop_AppRole, - /// - CreateSchema = EMDEventType.x_eet_Create_Schema, - /// - AlterSchema = EMDEventType.x_eet_Alter_Schema, - /// - DropSchema = EMDEventType.x_eet_Drop_Schema, - /// - CreateLogin = EMDEventType.x_eet_Create_Login, - /// - AlterLogin = EMDEventType.x_eet_Alter_Login, - /// - DropLogin = EMDEventType.x_eet_Drop_Login, - /// - CreateMsgType = EMDEventType.x_eet_Create_MsgType, - /// - DropMsgType = EMDEventType.x_eet_Drop_MsgType, - /// - CreateContract = EMDEventType.x_eet_Create_Contract, - /// - DropContract = EMDEventType.x_eet_Drop_Contract, - /// - CreateQueue = EMDEventType.x_eet_Create_Queue, - /// - AlterQueue = EMDEventType.x_eet_Alter_Queue, - /// - DropQueue = EMDEventType.x_eet_Drop_Queue, - /// - CreateService = EMDEventType.x_eet_Create_Service, - /// - AlterService = EMDEventType.x_eet_Alter_Service, - /// - DropService = EMDEventType.x_eet_Drop_Service, - /// - CreateRoute = EMDEventType.x_eet_Create_Route, - /// - AlterRoute = EMDEventType.x_eet_Alter_Route, - /// - DropRoute = EMDEventType.x_eet_Drop_Route, - /// - GrantStatement = EMDEventType.x_eet_Grant_Statement, - /// - DenyStatement = EMDEventType.x_eet_Deny_Statement, - /// - RevokeStatement = EMDEventType.x_eet_Revoke_Statement, - /// - GrantObject = EMDEventType.x_eet_Grant_Object, - /// - DenyObject = EMDEventType.x_eet_Deny_Object, - /// - RevokeObject = EMDEventType.x_eet_Revoke_Object, - /// - CreateBinding = EMDEventType.x_eet_Create_Binding, - /// - AlterBinding = EMDEventType.x_eet_Alter_Binding, - /// - DropBinding = EMDEventType.x_eet_Drop_Binding, - /// - CreatePartitionFunction = EMDEventType.x_eet_Create_Partition_Function, - /// - AlterPartitionFunction = EMDEventType.x_eet_Alter_Partition_Function, - /// - DropPartitionFunction = EMDEventType.x_eet_Drop_Partition_Function, - /// - CreatePartitionScheme = EMDEventType.x_eet_Create_Partition_Scheme, - /// - AlterPartitionScheme = EMDEventType.x_eet_Alter_Partition_Scheme, - /// - DropPartitionScheme = EMDEventType.x_eet_Drop_Partition_Scheme, - } -} diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/TriggerAction.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/TriggerAction.netfx.cs new file mode 100644 index 0000000000..fd57cedc72 --- /dev/null +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/TriggerAction.netfx.cs @@ -0,0 +1,263 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#if NETFRAMEWORK + +namespace Microsoft.Data.SqlClient.Server +{ + /// + public enum TriggerAction + { + /// + Invalid = 0, // Not actually a valid type: not persisted. + + /// + Insert = 1, + + /// + Update = 2, + + /// + Delete = 3, + + /// + CreateTable = 21, + + /// + AlterTable = 22, + + /// + DropTable = 23, + + /// + CreateIndex = 24, + + /// + AlterIndex = 25, + + /// + DropIndex = 26, + + /// + CreateSecurityExpression = 31, + + /// + DropSecurityExpression = 33, + + /// + CreateSynonym = 34, + + /// + DropSynonym = 36, + + /// + CreateView = 41, + + /// + AlterView = 42, + + /// + DropView = 43, + + /// + CreateProcedure = 51, + + /// + AlterProcedure = 52, + + /// + DropProcedure = 53, + + /// + CreateFunction = 61, + + /// + AlterFunction = 62, + + /// + DropFunction = 63, + + /// + CreateTrigger = 71, + + /// + AlterTrigger = 72, + + /// + DropTrigger = 73, + + /// + CreateEventNotification = 74, + + /// + DropEventNotification = 76, + + /// + CreateType = 91, + + // AlterType = 92, + + /// + DropType = 93, + + /// + CreateAssembly = 101, + + /// + AlterAssembly = 102, + + /// + DropAssembly = 103, + + /// + CreateUser = 131, + + /// + AlterUser = 132, + + /// + DropUser = 133, + + /// + CreateRole = 134, + + /// + AlterRole = 135, + + /// + DropRole = 136, + + /// + CreateAppRole = 137, + + /// + AlterAppRole = 138, + + /// + DropAppRole = 139, + + /// + CreateSchema = 141, + + /// + AlterSchema = 142, + + /// + DropSchema = 143, + + /// + CreateLogin = 144, + + /// + AlterLogin = 145, + + /// + DropLogin = 146, + + /// + CreateMsgType = 151, + + // AlterMsgType = 152 + + /// + DropMsgType = 153, + + /// + CreateContract = 154, + + // AlterContract = 155 + + /// + DropContract = 156, + + /// + CreateQueue = 157, + + /// + AlterQueue = 158, + + /// + DropQueue = 159, + + /// + CreateService = 161, + + /// + AlterService = 162, + + /// + DropService = 163, + + /// + CreateRoute = 164, + + /// + AlterRoute = 165, + + /// + DropRoute = 166, + + /// + GrantStatement = 167, + + /// + DenyStatement = 168, + + /// + RevokeStatement = 169, + + /// + GrantObject = 170, + + /// + DenyObject = 171, + + /// + RevokeObject = 172, + + /// + CreateBinding = 174, + + /// + AlterBinding = 175, + + /// + DropBinding = 176, + + // CreateXmlSchema = 177 + // AlterXmlSchema = 178 + // DropXmlSchema = 179 + // CreateHttpEndpoint = 181 + // AlterHttpEndpoint = 182 + // DropHttpEndpoint = 183 + + /// + CreatePartitionFunction = 191, + + /// + AlterPartitionFunction = 192, + + /// + DropPartitionFunction = 193, + + /// + CreatePartitionScheme = 194, + + /// + AlterPartitionScheme = 195, + + /// + DropPartitionScheme = 196, + + // CreateDatabase = 201 + // AlterDatabase = 202 + // DropDatabase = 203 + + // 1000-1999 is reserved for SqlTrace + // TraceStart = 1000 + // TraceEnd = 1999 + } +} + +#endif From 1b1ca6cf70720a89886b4959d3727bf0177a37ae Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Fri, 2 May 2025 13:28:26 -0500 Subject: [PATCH 12/12] Patch up changes so they all build --- .../Microsoft/Data/SqlClient/SqlCommand.cs | 6 ++--- .../Server/SmiRequestExecutor.netfx.cs | 23 +++++++++++++++++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs index c4c49a9cf2..70d9f72ebc 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -405,7 +405,7 @@ internal override void ParameterAvailable(SmiParameterMetaData metaData, SmiType private SmiContext _smiRequestContext; // context that _smiRequest came from private CommandEventSink _smiEventSink; - private SmiEventSink_DeferedProcessing _outParamEventSink; + private SmiEventSink_DeferredProcessing _outParamEventSink; private CommandEventSink EventSink { @@ -421,13 +421,13 @@ private CommandEventSink EventSink } } - private SmiEventSink_DeferedProcessing OutParamEventSink + private SmiEventSink_DeferredProcessing OutParamEventSink { get { if (_outParamEventSink == null) { - _outParamEventSink = new SmiEventSink_DeferedProcessing(EventSink); + _outParamEventSink = new SmiEventSink_DeferredProcessing(EventSink); } else { diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.netfx.cs index 45a9db186e..17ad326ae2 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.netfx.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRequestExecutor.netfx.cs @@ -4,11 +4,13 @@ #if NETFRAMEWORK +using System; using System.Data; using System.Transactions; namespace Microsoft.Data.SqlClient.Server { + // @TODO: This class is abstract but nothing inherits from it. Code paths that use it are likely very dead. internal abstract class SmiRequestExecutor : SmiTypedGetterSetter { public virtual void Close(SmiEventSink eventSink) @@ -18,9 +20,9 @@ public virtual void Close(SmiEventSink eventSink) // Implement body with throw because there are only a couple of ways to get to this code: // 1) Client is calling this method even though the server negotiated for V2- and hasn't implemented V3 yet. // 2) Server didn't implement V3 on some interface, but negotiated V3+. - throw Microsoft.Data.Common.ADP.InternalError(Microsoft.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); + throw Common.ADP.InternalError(Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } - + internal virtual SmiEventStream Execute( SmiConnection connection, // Assigned connection long transactionId, // Assigned transaction @@ -36,6 +38,21 @@ internal virtual SmiEventStream Execute( // 2) Server didn't implement V210 on some interface, but negotiated V210+. throw Common.ADP.InternalError(Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } + + internal virtual SmiEventStream Execute( + SmiConnection connection, // Assigned connection + long transactionId, // Assigned transaction + CommandBehavior behavior, // CommandBehavior, + SmiExecuteType executeType // Type of execute called (NonQuery/Pipe/Reader/Row, etc) + ) + { + // Obsoleting as of V210 + + // Implement body with throw because there are only a couple of ways to get to this code: + // 1) Client is calling this method even though the server negotiated for V210+ (and doesn't implement it). + // 2) Server doesn't implement this method, but negotiated V200-. + throw Common.ADP.InternalError(Common.ADP.InternalErrorCode.UnimplementedSMIMethod); + } // RequestExecutor only supports setting parameter values, not getting internal override bool CanGet => false; @@ -51,6 +68,8 @@ internal virtual SmiEventStream Execute( // SmiRequestExecutor subclasses must implement all Setters from SmiTypedGetterSetter // SmiRequestExecutor itself does not need to implement these, since it inherits the default implementation from // SmiTypedGetterSetter + + } }