From 1cd872baf8634e073d0fe987fcb16f5fe0d4840d Mon Sep 17 00:00:00 2001 From: Wraith2 Date: Wed, 24 Jun 2020 23:33:13 +0100 Subject: [PATCH] move equal files to shared source --- .../src/Microsoft.Data.SqlClient.csproj | 52 +++- .../SqlClient/Server/SqlFunctionAttribute.cs | 104 ------- .../netfx/src/Microsoft.Data.SqlClient.csproj | 52 +++- .../ProviderBase/DbConnectionPoolOptions.cs | 74 ----- .../SqlClient/Server/ExtendedClrTypeCode.cs | 60 ---- .../Data/SqlClient/Server/ITypedGetters.cs | 101 ------- .../Data/SqlClient/Server/ITypedGettersV3.cs | 70 ----- .../Data/SqlClient/Server/ITypedSetters.cs | 98 ------- .../Data/SqlClient/Server/ITypedSettersV3.cs | 80 ------ .../SqlClient/Server/MemoryRecordBuffer.cs | 264 ------------------ .../Data/SqlClient/Server/SmiGettersStream.cs | 109 -------- .../Data/SqlClient/Server/SmiSettersStream.cs | 109 -------- .../SqlClient/Server/SmiXetterTypeCode.cs | 30 -- .../SqlClient/Server/SqlFunctionAttribute.cs | 146 ---------- .../SqlClient/Server/SqlMethodAttribute.cs | 66 ----- .../Server/SqlUserDefinedTypeAttribute.cs | 147 ---------- .../ProviderBase/DbConnectionPoolOptions.cs | 0 .../SqlClient/Server/ExtendedClrTypeCode.cs | 0 .../Data/SqlClient/Server/ITypedGetters.cs | 0 .../Data/SqlClient/Server/ITypedGettersV3.cs | 0 .../Data/SqlClient/Server/ITypedSetters.cs | 0 .../Data/SqlClient/Server/ITypedSettersV3.cs | 0 .../SqlClient/Server/MemoryRecordBuffer.cs | 0 .../Data/SqlClient/Server/SmiGettersStream.cs | 0 .../Data/SqlClient/Server/SmiSettersStream.cs | 0 .../SqlClient/Server/SmiXetterTypeCode.cs | 0 .../SqlClient/Server/SqlFunctionAttribute.cs | 104 +++++++ .../SqlClient/Server/SqlMethodAttribute.cs | 10 +- .../Server/SqlUserDefinedTypeAttribute.cs | 24 +- 29 files changed, 199 insertions(+), 1501 deletions(-) delete mode 100644 src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/ProviderBase/DbConnectionPoolOptions.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ExtendedClrTypeCode.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedGetters.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedSetters.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiXetterTypeCode.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/ProviderBase/DbConnectionPoolOptions.cs (100%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/ExtendedClrTypeCode.cs (100%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/ITypedGetters.cs (100%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs (100%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/ITypedSetters.cs (100%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs (100%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs (100%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs (100%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs (100%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/SmiXetterTypeCode.cs (100%) create mode 100644 src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs (56%) rename src/Microsoft.Data.SqlClient/{netcore => }/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs (62%) 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 b83ca8a3ec..29a0f61505 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -48,6 +48,9 @@ Microsoft\Data\ProviderBase\DbConnectionPoolProviderInfo.cs + + Microsoft\Data\ProviderBase\DbConnectionPoolOptions.cs + Microsoft\Data\ProviderBase\DbConnectionPoolGroupProviderInfo.cs @@ -66,9 +69,45 @@ Microsoft\Data\SqlClient\ActiveDirectoryAuthenticationProvider.cs + + Microsoft\Data\SqlClient\Server\ExtendedClrTypeCode.cs + Microsoft\Data\SqlClient\Server\IBinarySerialize.cs + + Microsoft\Data\SqlClient\Server\ITypedGetters.cs + + + Microsoft\Data\SqlClient\Server\ITypedGettersV3.cs + + + Microsoft\Data\SqlClient\Server\ITypedSetters.cs + + + Microsoft\Data\SqlClient\Server\ITypedSettersV3.cs + + + Microsoft\Data\SqlClient\Server\MemoryRecordBuffer.cs + + + Microsoft\Data\SqlClient\Server\SmiGettersStream.cs + + + Microsoft\Data\SqlClient\Server\SmiSettersStream.cs + + + Microsoft\Data\SqlClient\Server\SmiXetterTypeCode.cs + + + Microsoft\Data\SqlClient\Server\SqlFunctionAttribute.cs + + + Microsoft\Data\SqlClient\Server\SqlMethodAttribute.cs + + + Microsoft\Data\SqlClient\Server\SqlUserDefinedTypeAttribute.cs + Microsoft\Data\SqlClient\ColumnEncryptionKeyInfo.cs @@ -217,23 +256,14 @@ - - - - - - - - - @@ -293,16 +323,12 @@ - - - - diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs deleted file mode 100644 index 26fde92aa2..0000000000 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs +++ /dev/null @@ -1,104 +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; - -namespace Microsoft.Data.SqlClient.Server -{ - /// - [Serializable] - public enum DataAccessKind - { - /// - None = 0, - /// - Read = 1, - } - - /// - [Serializable] - public enum SystemDataAccessKind - { - /// - None = 0, - /// - Read = 1, - } - - /// - // sql specific attribute - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false), Serializable] - public class SqlFunctionAttribute : Attribute - { - private bool _isDeterministic; - private DataAccessKind _dataAccess; - private SystemDataAccessKind _systemDataAccess; - private bool _isPrecise; - private string _name; - private string _tableDefinition; - private string _fillRowMethodName; - - /// - public SqlFunctionAttribute() - { - // default values - _isDeterministic = false; - _dataAccess = DataAccessKind.None; - _systemDataAccess = SystemDataAccessKind.None; - _isPrecise = false; - _name = null; - _tableDefinition = null; - _fillRowMethodName = null; - } - - /// - public bool IsDeterministic - { - get => _isDeterministic; - set => _isDeterministic = value; - } - - /// - public DataAccessKind DataAccess - { - get => _dataAccess; - set => _dataAccess = value; - } - - /// - public SystemDataAccessKind SystemDataAccess - { - get => _systemDataAccess; - set => _systemDataAccess = value; - } - - /// - public bool IsPrecise - { - get => _isPrecise; - set => _isPrecise = value; - } - - /// - public string Name - { - get => _name; - set => _name = value; - } - - /// - public string TableDefinition - { - get => _tableDefinition; - set => _tableDefinition = value; - } - - /// - public string FillRowMethodName - { - get => _fillRowMethodName; - set => _fillRowMethodName = value; - } - } -} 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 a1c099b526..f3b68d3da1 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -105,6 +105,9 @@ Microsoft\Data\ProviderBase\DbConnectionPoolProviderInfo.cs + + Microsoft\Data\ProviderBase\DbConnectionPoolOptions.cs + Microsoft\Data\ProviderBase\DbConnectionPoolGroupProviderInfo.cs @@ -123,9 +126,45 @@ Microsoft\Data\SqlClient\ActiveDirectoryAuthenticationProvider.cs + + Microsoft\Data\SqlClient\Server\ExtendedClrTypeCode.cs + Microsoft\Data\SqlClient\Server\IBinarySerialize.cs + + Microsoft\Data\SqlClient\Server\ITypedGetters.cs + + + Microsoft\Data\SqlClient\Server\ITypedGettersV3.cs + + + Microsoft\Data\SqlClient\Server\ITypedSetters.cs + + + Microsoft\Data\SqlClient\Server\ITypedSettersV3.cs + + + Microsoft\Data\SqlClient\Server\MemoryRecordBuffer.cs + + + Microsoft\Data\SqlClient\Server\SmiGettersStream.cs + + + Microsoft\Data\SqlClient\Server\SmiSettersStream.cs + + + Microsoft\Data\SqlClient\Server\SmiXetterTypeCode.cs + + + Microsoft\Data\SqlClient\Server\SqlFunctionAttribute.cs + + + Microsoft\Data\SqlClient\Server\SqlMethodAttribute.cs + + + Microsoft\Data\SqlClient\Server\SqlUserDefinedTypeAttribute.cs + Microsoft\Data\SqlClient\ColumnEncryptionKeyInfo.cs @@ -256,11 +295,8 @@ - - - @@ -371,7 +407,6 @@ - @@ -379,12 +414,6 @@ - - - - - - @@ -394,19 +423,16 @@ - - - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/ProviderBase/DbConnectionPoolOptions.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/ProviderBase/DbConnectionPoolOptions.cs deleted file mode 100644 index e7a03e5944..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/ProviderBase/DbConnectionPoolOptions.cs +++ /dev/null @@ -1,74 +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.ProviderBase -{ - - using System; - - internal sealed class DbConnectionPoolGroupOptions - { - - private readonly bool _poolByIdentity; - private readonly int _minPoolSize; - private readonly int _maxPoolSize; - private readonly int _creationTimeout; - private readonly TimeSpan _loadBalanceTimeout; - private readonly bool _hasTransactionAffinity; - private readonly bool _useLoadBalancing; - - public DbConnectionPoolGroupOptions( - bool poolByIdentity, - int minPoolSize, - int maxPoolSize, - int creationTimeout, - int loadBalanceTimeout, - bool hasTransactionAffinity) - { - _poolByIdentity = poolByIdentity; - _minPoolSize = minPoolSize; - _maxPoolSize = maxPoolSize; - _creationTimeout = creationTimeout; - - if (0 != loadBalanceTimeout) - { - _loadBalanceTimeout = new TimeSpan(0, 0, loadBalanceTimeout); - _useLoadBalancing = true; - } - - _hasTransactionAffinity = hasTransactionAffinity; - } - - public int CreationTimeout - { - get { return _creationTimeout; } - } - public bool HasTransactionAffinity - { - get { return _hasTransactionAffinity; } - } - public TimeSpan LoadBalanceTimeout - { - get { return _loadBalanceTimeout; } - } - public int MaxPoolSize - { - get { return _maxPoolSize; } - } - public int MinPoolSize - { - get { return _minPoolSize; } - } - public bool PoolByIdentity - { - get { return _poolByIdentity; } - } - public bool UseLoadBalancing - { - get { return _useLoadBalancing; } - } - } -} - - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ExtendedClrTypeCode.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ExtendedClrTypeCode.cs deleted file mode 100644 index d1525cb597..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ExtendedClrTypeCode.cs +++ /dev/null @@ -1,60 +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 ExtendedClrTypeCode - { - Invalid = -1, - Boolean, // System.Boolean - Byte, // System.Byte - Char, // System.Char - DateTime, // System.DateTime - DBNull, // System.DBNull - Decimal, // System.Decimal - Double, // System.Double - Empty, // null reference - Int16, // System.Int16 - Int32, // System.Int32 - Int64, // System.Int64 - SByte, // System.SByte - Single, // System.Single - String, // System.String - UInt16, // System.UInt16 - UInt32, // System.UInt32 - UInt64, // System.UInt64 - Object, // System.Object - ByteArray, // System.ByteArray - CharArray, // System.CharArray - Guid, // System.Guid - SqlBinary, // System.Data.SqlTypes.SqlBinary - SqlBoolean, // System.Data.SqlTypes.SqlBoolean - SqlByte, // System.Data.SqlTypes.SqlByte - SqlDateTime, // System.Data.SqlTypes.SqlDateTime - SqlDouble, // System.Data.SqlTypes.SqlDouble - SqlGuid, // System.Data.SqlTypes.SqlGuid - SqlInt16, // System.Data.SqlTypes.SqlInt16 - SqlInt32, // System.Data.SqlTypes.SqlInt32 - SqlInt64, // System.Data.SqlTypes.SqlInt64 - SqlMoney, // System.Data.SqlTypes.SqlMoney - SqlDecimal, // System.Data.SqlTypes.SqlDecimal - SqlSingle, // System.Data.SqlTypes.SqlSingle - SqlString, // System.Data.SqlTypes.SqlString - SqlChars, // System.Data.SqlTypes.SqlChars - SqlBytes, // System.Data.SqlTypes.SqlBytes - SqlXml, // System.Data.SqlTypes.SqlXml - DataTable, // Microsoft.Data.DataTable - DbDataReader, // System.Data.DbDataReader (SqlDataReader falls under this category) - IEnumerableOfSqlDataRecord, // System.Collections.Generic.IEnumerable - TimeSpan, // System.TimeSpan - DateTimeOffset, // System.DateTimeOffset - Stream, // System.IO.Stream - TextReader, // System.IO.TextReader - XmlReader, // System.Xml.XmlReader - Last = XmlReader, // end-of-enum marker - First = Boolean, // beginning-of-enum marker - }; -} - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedGetters.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedGetters.cs deleted file mode 100644 index 281edd25ac..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedGetters.cs +++ /dev/null @@ -1,101 +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; - -namespace Microsoft.Data.SqlClient.Server -{ - - // Interface for strongly-typed value getters - internal interface ITypedGetters - { - - // Null test - bool IsDBNull(int ordinal); - - // Check what type current sql_variant value is - SqlDbType GetVariantType(int ordinal); - - // By value accessors (data copy across the interface boundary implied) - Boolean GetBoolean(int ordinal); - - Byte GetByte(int ordinal); - - Int64 GetBytes(int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length); - - Char GetChar(int ordinal); - - Int64 GetChars(int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length); - - Int16 GetInt16(int ordinal); - - Int32 GetInt32(int ordinal); - - Int64 GetInt64(int ordinal); - - Single GetFloat(int ordinal); - - Double GetDouble(int ordinal); - - String GetString(int ordinal); - - Decimal GetDecimal(int ordinal); - - DateTime GetDateTime(int ordinal); - - Guid GetGuid(int ordinal); - - SqlBoolean GetSqlBoolean(int ordinal); - - SqlByte GetSqlByte(int ordinal); - - SqlInt16 GetSqlInt16(int ordinal); - - SqlInt32 GetSqlInt32(int ordinal); - - SqlInt64 GetSqlInt64(int ordinal); - - SqlSingle GetSqlSingle(int ordinal); - - SqlDouble GetSqlDouble(int ordinal); - - SqlMoney GetSqlMoney(int ordinal); - - SqlDateTime GetSqlDateTime(int ordinal); - - SqlDecimal GetSqlDecimal(int ordinal); - - SqlString GetSqlString(int ordinal); - - SqlBinary GetSqlBinary(int ordinal); - - SqlGuid GetSqlGuid(int ordinal); - - SqlChars GetSqlChars(int ordinal); - - SqlBytes GetSqlBytes(int ordinal); - - SqlXml GetSqlXml(int ordinal); - - - // "By reference" accessors - // May hook to buffer. - // Semantics guarantee is that as long as the object exposing the accessor is not logically - // moved to a new set of values and the overall state (open/closed) isn't changed, it will not - // change the underlying value returned and continue to allow access to it. - // - // Example: GetSqlCharsRef called on an event stream value. The back-end optimizes by re-using - // the buffer wrapped by the returned SqlChars on the next row event, but guarantees that it - // won't change the value until the next event is consumed. - // - // Simplest way to guarantee this behavior is to simply call the corresponding by-value accessor. - SqlBytes GetSqlBytesRef(int ordinal); - - SqlChars GetSqlCharsRef(int ordinal); - - SqlXml GetSqlXmlRef(int ordinal); - } -} diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs deleted file mode 100644 index eb2ecdfcc3..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs +++ /dev/null @@ -1,70 +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.SqlTypes; - -namespace Microsoft.Data.SqlClient.Server -{ - - // Interface for strongly-typed value getters - internal interface ITypedGettersV3 - { - - // Null test - // valid for all types - bool IsDBNull(SmiEventSink sink, int ordinal); - - // Check what type current sql_variant value is - // valid for SqlDbType.Variant - SmiMetaData GetVariantType(SmiEventSink sink, int ordinal); - - // - // Actual value accessors - // valid type indicates column must be of the type or column must be variant - // and GetVariantType returned the type - // - - // valid for SqlDbType.Bit - Boolean GetBoolean(SmiEventSink sink, int ordinal); - - // valid for SqlDbType.TinyInt - Byte GetByte(SmiEventSink sink, int ordinal); - - // valid for SqlDbTypes: Binary, VarBinary, Image, Udt, Xml, Char, VarChar, Text, NChar, NVarChar, NText - // (Character type support needed for ExecuteXmlReader handling) - Int64 GetBytesLength(SmiEventSink sink, int ordinal); - int GetBytes(SmiEventSink sink, int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length); - - // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText - Int64 GetCharsLength(SmiEventSink sink, int ordinal); - int GetChars(SmiEventSink sink, int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length); - String GetString(SmiEventSink sink, int ordinal); - - // valid for SqlDbType.SmallInt - Int16 GetInt16(SmiEventSink sink, int ordinal); - - // valid for SqlDbType.Int - Int32 GetInt32(SmiEventSink sink, int ordinal); - - // valid for SqlDbType.BigInt, SqlDbType.Money, SqlDbType.SmallMoney - Int64 GetInt64(SmiEventSink sink, int ordinal); - - // valid for SqlDbType.Real - Single GetSingle(SmiEventSink sink, int ordinal); - - // valid for SqlDbType.Float - Double GetDouble(SmiEventSink sink, int ordinal); - - // valid for SqlDbType.Numeric (uses SqlDecimal since Decimal cannot hold full range) - SqlDecimal GetSqlDecimal(SmiEventSink sink, int ordinal); - - // valid for DateTime & SmallDateTime - DateTime GetDateTime(SmiEventSink sink, int ordinal); - - // valid for UniqueIdentifier - Guid GetGuid(SmiEventSink sink, int ordinal); - } -} - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedSetters.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedSetters.cs deleted file mode 100644 index 83e0a8b8ae..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedSetters.cs +++ /dev/null @@ -1,98 +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.SqlTypes; - -namespace Microsoft.Data.SqlClient.Server -{ - - // interface for strongly-typed value setters - internal interface ITypedSetters - { - - // By value setters (data copy across the interface boundary implied) - void SetDBNull(int ordinal); - - void SetBoolean(int ordinal, Boolean value); - - void SetByte(int ordinal, Byte value); - - void SetBytes(int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length); - - void SetChar(int ordinal, char value); - - void SetChars(int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length); - - void SetInt16(int ordinal, Int16 value); - - void SetInt32(int ordinal, Int32 value); - - void SetInt64(int ordinal, Int64 value); - - void SetFloat(int ordinal, Single value); - - void SetDouble(int ordinal, Double value); - - [ObsoleteAttribute("Not supported as of SMI v2. Will be removed when v1 support dropped. Use setter with offset.")] - void SetString(int ordinal, string value); - - // Method introduced as of SMI V2 - void SetString(int ordinal, string value, int offset); - - void SetDecimal(int ordinal, Decimal value); - - void SetDateTime(int ordinal, DateTime value); - - void SetGuid(int ordinal, Guid value); - - void SetSqlBoolean(int ordinal, SqlBoolean value); - - void SetSqlByte(int ordinal, SqlByte value); - - void SetSqlInt16(int ordinal, SqlInt16 value); - - void SetSqlInt32(int ordinal, SqlInt32 value); - - void SetSqlInt64(int ordinal, SqlInt64 value); - - void SetSqlSingle(int ordinal, SqlSingle value); - - void SetSqlDouble(int ordinal, SqlDouble value); - - void SetSqlMoney(int ordinal, SqlMoney value); - - void SetSqlDateTime(int ordinal, SqlDateTime value); - - void SetSqlDecimal(int ordinal, SqlDecimal value); - - [ObsoleteAttribute("Not supported as of SMI v2. Will be removed when v1 support dropped. Use setter with offset.")] - void SetSqlString(int ordinal, SqlString value); - - // Method introduced as of SMI V2 - void SetSqlString(int ordinal, SqlString value, int offset); - - [ObsoleteAttribute("Not supported as of SMI v2. Will be removed when v1 support dropped. Use setter with offset.")] - void SetSqlBinary(int ordinal, SqlBinary value); - - // Method introduced as of SMI V2 - void SetSqlBinary(int ordinal, SqlBinary value, int offset); - - void SetSqlGuid(int ordinal, SqlGuid value); - - [ObsoleteAttribute("Not supported as of SMI v2. Will be removed when v1 support dropped. Use setter with offset.")] - void SetSqlChars(int ordinal, SqlChars value); - - // Method introduced as of SMI V2 - void SetSqlChars(int ordinal, SqlChars value, int offset); - - [ObsoleteAttribute("Not supported as of SMI v2. Will be removed when v1 support dropped. Use setter with offset.")] - void SetSqlBytes(int ordinal, SqlBytes value); - - // Method introduced as of SMI V2 - void SetSqlBytes(int ordinal, SqlBytes value, int offset); - - void SetSqlXml(int ordinal, SqlXml value); - } -} diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs deleted file mode 100644 index d0bf5a86dc..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs +++ /dev/null @@ -1,80 +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.SqlTypes; - -namespace Microsoft.Data.SqlClient.Server -{ - - // interface for strongly-typed value setters - internal interface ITypedSettersV3 - { - - // By value setters (data copy across the interface boundary implied) - // All setters are valid for SqlDbType.Variant - - // SetVariantMetaData is used to set the precise type of data just before pushing - // data into a variant type via one one of the other setters. It - // is only valid to set metadata with a SqlDbType that is associated with the - // data setter that will be called. - // Since LOBs, Udt's and fixed-length types are not currently stored in a variant, - // the following pairs are the only setters/sqldbtypes that need this call: - // NVarChar/VarChar + SetString (needed only for non-global collation, i.e. SqlString) - // Money/SmallMoney + SetInt64 - void SetVariantMetaData(SmiEventSink sink, int ordinal, SmiMetaData metaData); - - // Set value to null - // valid for all types - void SetDBNull(SmiEventSink sink, int ordinal); - - // valid for SqlDbType.Bit - void SetBoolean(SmiEventSink sink, int ordinal, Boolean value); - - // valid for SqlDbType.TinyInt - void SetByte(SmiEventSink sink, int ordinal, Byte value); - - // Semantics for SetBytes are to modify existing value, not overwrite - // Use in combination with SetLength to ensure overwriting when necessary - // valid for SqlDbTypes: Binary, VarBinary, Image, Udt, Xml - // (VarBinary assumed for variants) - int SetBytes(SmiEventSink sink, int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length); - void SetBytesLength(SmiEventSink sink, int ordinal, long length); - - // Semantics for SetChars are to modify existing value, not overwrite - // Use in combination with SetLength to ensure overwriting when necessary - // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText - // (NVarChar and global clr collation assumed for variants) - int SetChars(SmiEventSink sink, int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length); - void SetCharsLength(SmiEventSink sink, int ordinal, long length); - - // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText - void SetString(SmiEventSink sink, int ordinal, string value, int offset, int length); - - // valid for SqlDbType.SmallInt - void SetInt16(SmiEventSink sink, int ordinal, Int16 value); - - // valid for SqlDbType.Int - void SetInt32(SmiEventSink sink, int ordinal, Int32 value); - - // valid for SqlDbType.BigInt, SqlDbType.Money, SqlDbType.SmallMoney - void SetInt64(SmiEventSink sink, int ordinal, Int64 value); - - // valid for SqlDbType.Real - void SetSingle(SmiEventSink sink, int ordinal, Single value); - - // valid for SqlDbType.Float - void SetDouble(SmiEventSink sink, int ordinal, Double value); - - // valid for SqlDbType.Numeric (uses SqlDecimal since Decimal cannot hold full range) - void SetSqlDecimal(SmiEventSink sink, int ordinal, SqlDecimal value); - - // valid for DateTime & SmallDateTime - void SetDateTime(SmiEventSink sink, int ordinal, DateTime value); - - // valid for UniqueIdentifier - void SetGuid(SmiEventSink sink, int ordinal, Guid value); - } -} - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs deleted file mode 100644 index 1fdb0cbc42..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs +++ /dev/null @@ -1,264 +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.SqlTypes; -using System.Diagnostics; - -namespace Microsoft.Data.SqlClient.Server -{ - - // Class for implementing a record object used in out-of-proc scenarios. - internal sealed class MemoryRecordBuffer : SmiRecordBuffer - { - - private SqlRecordBuffer[] _buffer; - - internal MemoryRecordBuffer(SmiMetaData[] metaData) - { - Debug.Assert(null != metaData, "invalid attempt to instantiate MemoryRecordBuffer with null SmiMetaData[]"); - - _buffer = new SqlRecordBuffer[metaData.Length]; - - for (int i = 0; i < _buffer.Length; ++i) - { - _buffer[i] = new SqlRecordBuffer(metaData[i]); - } - } - - #region Getters - // Null test - // valid for all types - public override bool IsDBNull(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].IsNull; - } - - // Check what type current sql_variant value is - // valid for SqlDbType.Variant - public override SmiMetaData GetVariantType(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].VariantType; - } - - // valid for SqlDbType.Bit - public override Boolean GetBoolean(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].Boolean; - } - - // valid for SqlDbType.TinyInt - public override Byte GetByte(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].Byte; - } - - // valid for SqlDbTypes: Binary, VarBinary, Image, Udt, Xml, Char, VarChar, Text, NChar, NVarChar, NText - // (Character type support needed for ExecuteXmlReader handling) - public override Int64 GetBytesLength(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].BytesLength; - } - public override int GetBytes(SmiEventSink sink, int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) - { - return _buffer[ordinal].GetBytes(fieldOffset, buffer, bufferOffset, length); - } - - // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText - public override Int64 GetCharsLength(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].CharsLength; - } - public override int GetChars(SmiEventSink sink, int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) - { - return _buffer[ordinal].GetChars(fieldOffset, buffer, bufferOffset, length); - } - public override String GetString(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].String; - } - - // valid for SqlDbType.SmallInt - public override Int16 GetInt16(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].Int16; - } - - // valid for SqlDbType.Int - public override Int32 GetInt32(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].Int32; - } - - // valid for SqlDbType.BigInt, SqlDbType.Money, SqlDbType.SmallMoney - public override Int64 GetInt64(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].Int64; - } - - // valid for SqlDbType.Real - public override Single GetSingle(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].Single; - } - - // valid for SqlDbType.Float - public override Double GetDouble(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].Double; - } - - // valid for SqlDbType.Numeric (uses SqlDecimal since Decimal cannot hold full range) - public override SqlDecimal GetSqlDecimal(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].SqlDecimal; - } - - // valid for DateTime, SmallDateTime, Date, and DateTime2 - public override DateTime GetDateTime(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].DateTime; - } - - // valid for UniqueIdentifier - public override Guid GetGuid(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].Guid; - } - - // valid for SqlDbType.Time - public override TimeSpan GetTimeSpan(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].TimeSpan; - } - - // valid for DateTimeOffset - public override DateTimeOffset GetDateTimeOffset(SmiEventSink sink, int ordinal) - { - return _buffer[ordinal].DateTimeOffset; - } - #endregion - - #region Setters - // Set value to null - // valid for all types - public override void SetDBNull(SmiEventSink sink, int ordinal) - { - _buffer[ordinal].SetNull(); - } - - // valid for SqlDbType.Bit - public override void SetBoolean(SmiEventSink sink, int ordinal, Boolean value) - { - _buffer[ordinal].Boolean = value; - } - - // valid for SqlDbType.TinyInt - public override void SetByte(SmiEventSink sink, int ordinal, Byte value) - { - _buffer[ordinal].Byte = value; - } - - // Semantics for SetBytes are to modify existing value, not overwrite - // Use in combination with SetLength to ensure overwriting when necessary - // valid for SqlDbTypes: Binary, VarBinary, Image, Udt, Xml - // (VarBinary assumed for variants) - public override int SetBytes(SmiEventSink sink, int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) - { - return _buffer[ordinal].SetBytes(fieldOffset, buffer, bufferOffset, length); - } - public override void SetBytesLength(SmiEventSink sink, int ordinal, long length) - { - _buffer[ordinal].BytesLength = length; - } - - // Semantics for SetChars are to modify existing value, not overwrite - // Use in combination with SetLength to ensure overwriting when necessary - // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText - // (NVarChar and global clr collation assumed for variants) - public override int SetChars(SmiEventSink sink, int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) - { - return _buffer[ordinal].SetChars(fieldOffset, buffer, bufferOffset, length); - } - public override void SetCharsLength(SmiEventSink sink, int ordinal, long length) - { - _buffer[ordinal].CharsLength = length; - } - - // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText - public override void SetString(SmiEventSink sink, int ordinal, string value, int offset, int length) - { - Debug.Assert(offset == 0 && length <= value.Length, "Invalid string length or offset"); // for sqlvariant, length could be less than value.Length - - _buffer[ordinal].String = value.Substring(offset, length); // Perf test shows that Substring method has already optimized the case where length = value.Length - } - - // valid for SqlDbType.SmallInt - public override void SetInt16(SmiEventSink sink, int ordinal, Int16 value) - { - _buffer[ordinal].Int16 = value; - } - - // valid for SqlDbType.Int - public override void SetInt32(SmiEventSink sink, int ordinal, Int32 value) - { - _buffer[ordinal].Int32 = value; - } - - // valid for SqlDbType.BigInt, SqlDbType.Money, SqlDbType.SmallMoney - public override void SetInt64(SmiEventSink sink, int ordinal, Int64 value) - { - _buffer[ordinal].Int64 = value; - } - - // valid for SqlDbType.Real - public override void SetSingle(SmiEventSink sink, int ordinal, Single value) - { - _buffer[ordinal].Single = value; - } - - // valid for SqlDbType.Float - public override void SetDouble(SmiEventSink sink, int ordinal, Double value) - { - _buffer[ordinal].Double = value; - } - - // valid for SqlDbType.Numeric (uses SqlDecimal since Decimal cannot hold full range) - public override void SetSqlDecimal(SmiEventSink sink, int ordinal, SqlDecimal value) - { - _buffer[ordinal].SqlDecimal = value; - } - - // valid for DateTime, SmallDateTime, Date, and DateTime2 - public override void SetDateTime(SmiEventSink sink, int ordinal, DateTime value) - { - _buffer[ordinal].DateTime = value; - } - - // valid for UniqueIdentifier - public override void SetGuid(SmiEventSink sink, int ordinal, Guid value) - { - _buffer[ordinal].Guid = value; - } - - // SqlDbType.Time - public override void SetTimeSpan(SmiEventSink sink, int ordinal, TimeSpan value) - { - _buffer[ordinal].TimeSpan = value; - } - - // DateTimeOffset - public override void SetDateTimeOffset(SmiEventSink sink, int ordinal, DateTimeOffset value) - { - _buffer[ordinal].DateTimeOffset = value; - } - - // valid for SqlDbType.Variant - public override void SetVariantMetaData(SmiEventSink sink, int ordinal, SmiMetaData metaData) - { - _buffer[ordinal].VariantType = metaData; - } - #endregion - } -} diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs deleted file mode 100644 index 9bf316e6c7..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs +++ /dev/null @@ -1,109 +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; -using System.IO; - -namespace Microsoft.Data.SqlClient.Server -{ - - internal class SmiGettersStream : Stream - { - - private SmiEventSink_Default _sink; - private ITypedGettersV3 _getters; - private int _ordinal; - private long _readPosition; - private SmiMetaData _metaData; - - internal SmiGettersStream(SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData) - { - Debug.Assert(null != sink); - Debug.Assert(null != getters); - Debug.Assert(0 <= ordinal); - Debug.Assert(null != metaData); - - _sink = sink; - _getters = getters; - _ordinal = ordinal; - _readPosition = 0; - _metaData = metaData; - } - - public override bool CanRead - { - get - { - return true; - } - } - - // If CanSeek is false, Position, Seek, Length, and SetLength should throw. - public override bool CanSeek - { - get - { - return false; - } - } - - public override bool CanWrite - { - get - { - return false; - } - } - - public override long Length - { - get - { - return ValueUtilsSmi.GetBytesInternal(_sink, _getters, _ordinal, _metaData, 0, null, 0, 0, false); - } - } - - public override long Position - { - get - { - return _readPosition; - } - set - { - throw SQL.StreamSeekNotSupported(); - } - } - - public override void Flush() - { - throw SQL.StreamWriteNotSupported(); - } - - public override long Seek(long offset, SeekOrigin origin) - { - throw SQL.StreamSeekNotSupported(); - } - - public override void SetLength(long value) - { - throw SQL.StreamWriteNotSupported(); - } - - public override int Read(byte[] buffer, int offset, int count) - { - long bytesRead = ValueUtilsSmi.GetBytesInternal(_sink, _getters, _ordinal, _metaData, _readPosition, buffer, offset, count, false); - _readPosition += bytesRead; - - return checked((int)bytesRead); - } - - public override void Write(byte[] buffer, int offset, int count) - { - throw SQL.StreamWriteNotSupported(); - } - } - -} - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs deleted file mode 100644 index abe20df8bc..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs +++ /dev/null @@ -1,109 +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; -using System.IO; -using Microsoft.Data.Common; - -namespace Microsoft.Data.SqlClient.Server -{ - - internal class SmiSettersStream : Stream - { - - private SmiEventSink_Default _sink; - private ITypedSettersV3 _setters; - private int _ordinal; - private long _lengthWritten; - private SmiMetaData _metaData; - - internal SmiSettersStream(SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData) - { - Debug.Assert(null != sink); - Debug.Assert(null != setters); - Debug.Assert(0 <= ordinal); - Debug.Assert(null != metaData); - - _sink = sink; - _setters = setters; - _ordinal = ordinal; - _lengthWritten = 0; - _metaData = metaData; - } - - public override bool CanRead - { - get - { - return false; - } - } - - // If CanSeek is false, Position, Seek, Length, and SetLength should throw. - public override bool CanSeek - { - get - { - return false; - } - } - - public override bool CanWrite - { - get - { - return true; - } - } - - public override long Length - { - get - { - return _lengthWritten; - } - } - - public override long Position - { - get - { - return _lengthWritten; - } - set - { - throw SQL.StreamSeekNotSupported(); - } - } - - public override void Flush() - { - _lengthWritten = ValueUtilsSmi.SetBytesLength(_sink, _setters, _ordinal, _metaData, _lengthWritten); - } - - public override long Seek(long offset, SeekOrigin origin) - { - throw SQL.StreamSeekNotSupported(); - } - - public override void SetLength(long value) - { - if (value < 0) - { - throw ADP.ArgumentOutOfRange("value"); - } - ValueUtilsSmi.SetBytesLength(_sink, _setters, _ordinal, _metaData, value); - } - - public override int Read(byte[] buffer, int offset, int count) - { - throw SQL.StreamReadNotSupported(); - } - - public override void Write(byte[] buffer, int offset, int count) - { - _lengthWritten += ValueUtilsSmi.SetBytes(_sink, _setters, _ordinal, _metaData, _lengthWritten, buffer, offset, count); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiXetterTypeCode.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiXetterTypeCode.cs deleted file mode 100644 index f1ad7663e4..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SmiXetterTypeCode.cs +++ /dev/null @@ -1,30 +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 -{ - - // Types should match Getter/Setter names - internal enum SmiXetterTypeCode - { - XetBoolean, - XetByte, - XetBytes, - XetChars, - XetString, - XetInt16, - XetInt32, - XetInt64, - XetSingle, - XetDouble, - XetSqlDecimal, - XetDateTime, - XetGuid, - GetVariantMetaData, // no set call, just get - GetXet, - XetTime, // XetTime mistakenly named, does not match getter/setter method name - XetTimeSpan = XetTime, // prefer using XetTimeSpan instead of XetTime. Both mean the same thing for now. - XetDateTimeOffset, - } -} diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs deleted file mode 100644 index 88355ba0ad..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs +++ /dev/null @@ -1,146 +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; - -namespace Microsoft.Data.SqlClient.Server -{ - /// - [Serializable] - public enum DataAccessKind - { - /// - None = 0, - /// - Read = 1, - } - - /// - [Serializable] - public enum SystemDataAccessKind - { - /// - None = 0, - /// - Read = 1, - } - - /// - // sql specific attribute - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false), Serializable] - public class SqlFunctionAttribute : System.Attribute - { - private bool m_fDeterministic; - private DataAccessKind m_eDataAccess; - private SystemDataAccessKind m_eSystemDataAccess; - private bool m_fPrecise; - private string m_fName; - private string m_fTableDefinition; - private string m_FillRowMethodName; - - /// - public SqlFunctionAttribute() - { - // default values - m_fDeterministic = false; - m_eDataAccess = DataAccessKind.None; - m_eSystemDataAccess = SystemDataAccessKind.None; - m_fPrecise = false; - m_fName = null; - m_fTableDefinition = null; - m_FillRowMethodName = null; - } // SqlFunctionAttribute - - /// - public bool IsDeterministic - { - get - { - return m_fDeterministic; - } - set - { - m_fDeterministic = value; - } - } // Deterministic - - /// - public DataAccessKind DataAccess - { - get - { - return m_eDataAccess; - } - set - { - m_eDataAccess = value; - } - } // public bool DataAccessKind - - /// - public SystemDataAccessKind SystemDataAccess - { - get - { - return m_eSystemDataAccess; - } - set - { - m_eSystemDataAccess = value; - } - } // public bool SystemDataAccessKind - - /// - public bool IsPrecise - { - get - { - return m_fPrecise; - } - set - { - m_fPrecise = value; - } - } // Precise - - /// - public string Name - { - get - { - return m_fName; - } - set - { - m_fName = value; - } - } - - /// - public string TableDefinition - { - get - { - return m_fTableDefinition; - } - set - { - m_fTableDefinition = value; - } - } - /// - public string FillRowMethodName - { - get - { - return m_FillRowMethodName; - } - set - { - m_FillRowMethodName = value; - } - } - - } // class SqlFunctionAttribute -} diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs deleted file mode 100644 index 6d17b3e5dc..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs +++ /dev/null @@ -1,66 +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; - -namespace Microsoft.Data.SqlClient.Server -{ - /// - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false), Serializable] - public sealed class SqlMethodAttribute : SqlFunctionAttribute - { - private bool m_fCallOnNullInputs; - private bool m_fMutator; - private bool m_fInvokeIfReceiverIsNull; - - /// - public SqlMethodAttribute() - { - // default values - m_fCallOnNullInputs = true; - m_fMutator = false; - m_fInvokeIfReceiverIsNull = false; - - } // SqlMethodAttribute - - /// - public bool OnNullCall - { - get - { - return m_fCallOnNullInputs; - } - set - { - m_fCallOnNullInputs = value; - } - } // CallOnNullInputs - - /// - public bool IsMutator - { - get - { - return m_fMutator; - } - set - { - m_fMutator = value; - } - } // IsMutator - - /// - public bool InvokeIfReceiverIsNull - { - get - { - return m_fInvokeIfReceiverIsNull; - } - set - { - m_fInvokeIfReceiverIsNull = value; - } - } // InvokeIfReceiverIsNull - } // class SqlMethodAttribute -} diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs deleted file mode 100644 index 345bd1d439..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs +++ /dev/null @@ -1,147 +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 Microsoft.Data.Common; - -namespace Microsoft.Data.SqlClient.Server -{ - /// - public enum Format - { //: byte - /// - Unknown = 0, - /// - Native = 1, - /// - UserDefined = 2, - } - - /// - // This custom attribute indicates that the given type is - // a SqlServer udt. The properties on the attribute reflect the - // physical attributes that will be used when the type is registered - // with SqlServer. - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)] - public sealed class SqlUserDefinedTypeAttribute : Attribute - { - private int m_MaxByteSize; - private bool m_IsFixedLength; - private bool m_IsByteOrdered; - private Format m_format; - private string m_fName; - - // The maximum value for the maxbytesize field, in bytes. - internal const int YukonMaxByteSizeValue = 8000; - private String m_ValidationMethodName = null; - - /// - // A required attribute on all udts, used to indicate that the - // given type is a udt, and its storage format. - public SqlUserDefinedTypeAttribute(Format format) - { - switch (format) - { - case Format.Unknown: - throw ADP.NotSupportedUserDefinedTypeSerializationFormat((Microsoft.Data.SqlClient.Server.Format)format, "format"); - case Format.Native: - case Format.UserDefined: - this.m_format = format; - break; - default: - throw ADP.InvalidUserDefinedTypeSerializationFormat((Microsoft.Data.SqlClient.Server.Format)format); - } - } - - /// - // The maximum size of this instance, in bytes. Does not have to be - // specified for Native serialization. The maximum value - // for this property is specified by MaxByteSizeValue. - public int MaxByteSize - { - get - { - return this.m_MaxByteSize; - } - set - { - if (value < -1) - { - throw ADP.ArgumentOutOfRange("MaxByteSize"); - } - this.m_MaxByteSize = value; - } - } - - /// - // Are all instances of this udt the same size on disk? - public bool IsFixedLength - { - get - { - return this.m_IsFixedLength; - } - set - { - this.m_IsFixedLength = value; - } - } - - /// - // Is this type byte ordered, i.e. is the on disk representation - // consistent with the ordering semantics for this type? - // If true, the binary representation of the type will be used - // in comparison by SqlServer. This property enables indexing on the - // udt and faster comparisons. - public bool IsByteOrdered - { - get - { - return this.m_IsByteOrdered; - } - set - { - this.m_IsByteOrdered = value; - } - } - - /// - // The on-disk format for this type. - public Format Format - { - get - { - return this.m_format; - } - } - - /// - // An Optional method used to validate this UDT - // Signature: bool <ValidationMethodName>(); - public String ValidationMethodName - { - get - { - return this.m_ValidationMethodName; - } - set - { - this.m_ValidationMethodName = value; - } - } - - /// - public string Name - { - get - { - return m_fName; - } - set - { - m_fName = value; - } - } - } -} diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionPoolOptions.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionPoolOptions.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionPoolOptions.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionPoolOptions.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ExtendedClrTypeCode.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ExtendedClrTypeCode.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ExtendedClrTypeCode.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ExtendedClrTypeCode.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ITypedGetters.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedGetters.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ITypedGetters.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedGetters.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ITypedSetters.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedSetters.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ITypedSetters.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedSetters.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiGettersStream.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiSettersStream.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SmiXetterTypeCode.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterTypeCode.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SmiXetterTypeCode.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiXetterTypeCode.cs diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs new file mode 100644 index 0000000000..87b84c7ba1 --- /dev/null +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlFunctionAttribute.cs @@ -0,0 +1,104 @@ +// 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; + +namespace Microsoft.Data.SqlClient.Server +{ + /// + [Serializable] + public enum DataAccessKind + { + /// + None = 0, + /// + Read = 1, + } + + /// + [Serializable] + public enum SystemDataAccessKind + { + /// + None = 0, + /// + Read = 1, + } + + /// + // sql specific attribute + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false), Serializable] + public class SqlFunctionAttribute : Attribute + { + private bool _isDeterministic; + private DataAccessKind _dataAccess; + private SystemDataAccessKind _systemDataAccess; + private bool _isPrecise; + private string _name; + private string _tableDefinition; + private string _fillRowMethodName; + + /// + public SqlFunctionAttribute() + { + // default values + _isDeterministic = false; + _dataAccess = DataAccessKind.None; + _systemDataAccess = SystemDataAccessKind.None; + _isPrecise = false; + _name = null; + _tableDefinition = null; + _fillRowMethodName = null; + } + + /// + public bool IsDeterministic + { + get => _isDeterministic; + set => _isDeterministic = value; + } + + /// + public DataAccessKind DataAccess + { + get => _dataAccess; + set => _dataAccess = value; + } + + /// + public SystemDataAccessKind SystemDataAccess + { + get => _systemDataAccess; + set => _systemDataAccess = value; + } + + /// + public bool IsPrecise + { + get => _isPrecise; + set => _isPrecise = value; + } + + /// + public string Name + { + get => _name; + set => _name = value; + } + + /// + public string TableDefinition + { + get => _tableDefinition; + set => _tableDefinition = value; + } + + /// + public string FillRowMethodName + { + get => _fillRowMethodName; + set => _fillRowMethodName = value; + } + } +} diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs similarity index 56% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs index 3a8c91e485..4b29c6df55 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlMethodAttribute.cs @@ -6,7 +6,7 @@ namespace Microsoft.Data.SqlClient.Server { - /// + /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false), Serializable] public sealed class SqlMethodAttribute : SqlFunctionAttribute { @@ -14,7 +14,7 @@ public sealed class SqlMethodAttribute : SqlFunctionAttribute private bool _isMutator; private bool _shouldInvokeIfReceiverIsNull; - /// + /// public SqlMethodAttribute() { // default values @@ -23,21 +23,21 @@ public SqlMethodAttribute() _shouldInvokeIfReceiverIsNull = false; } - /// + /// public bool OnNullCall { get => _isCalledOnNullInputs; set => _isCalledOnNullInputs = value; } - /// + /// public bool IsMutator { get => _isMutator; set => _isMutator = value; } - /// + /// public bool InvokeIfReceiverIsNull { get => _shouldInvokeIfReceiverIsNull; diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs similarity index 62% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs index 12a5ab3a8f..ffdcec4f2a 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlUserDefinedTypeAttribute.cs @@ -7,18 +7,18 @@ namespace Microsoft.Data.SqlClient.Server { - /// + /// public enum Format { - /// + /// Unknown = 0, - /// + /// Native = 1, - /// + /// UserDefined = 2, } - /// + /// // This custom attribute indicates that the given type is // a SqlServer udt. The properties on the attribute reflect the // physical attributes that will be used when the type is registered @@ -36,7 +36,7 @@ public sealed class SqlUserDefinedTypeAttribute : Attribute internal const int YukonMaxByteSizeValue = 8000; private string _validationMethodName = null; - /// + /// // A required attribute on all udts, used to indicate that the // given type is a udt, and its storage format. public SqlUserDefinedTypeAttribute(Format format) @@ -54,7 +54,7 @@ public SqlUserDefinedTypeAttribute(Format format) } } - /// + /// // The maximum size of this instance, in bytes. Does not have to be // specified for Native serialization. The maximum value // for this property is specified by MaxByteSizeValue. @@ -74,7 +74,7 @@ public int MaxByteSize } } - /// + /// // Are all instances of this udt the same size on disk? public bool IsFixedLength { @@ -88,7 +88,7 @@ public bool IsFixedLength } } - /// + /// // Is this type byte ordered, i.e. is the on disk representation // consistent with the ordering semantics for this type? // If true, the binary representation of the type will be used @@ -106,11 +106,11 @@ public bool IsByteOrdered } } - /// + /// // The on-disk format for this type. public Format Format => _format; - /// + /// // An Optional method used to validate this UDT public string ValidationMethodName { @@ -124,7 +124,7 @@ public string ValidationMethodName } } - /// + /// public string Name { get