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 9dae90ffd0..21e401c092 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -432,9 +432,6 @@ Microsoft\Data\SqlClient\Server\SmiMetaDataProperty.cs - - Microsoft\Data\SqlClient\Server\SmiRecordBuffer.cs - Microsoft\Data\SqlClient\Server\SmiSettersStream.cs @@ -450,9 +447,6 @@ Microsoft\Data\SqlClient\Server\SqlDataRecord.cs - - Microsoft\Data\SqlClient\Server\SqlDataRecord.netcore.cs - Microsoft\Data\SqlClient\Server\SqlMetaData.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 9ce3b09334..bdd7cb01bb 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -543,9 +543,6 @@ Microsoft\Data\SqlClient\Server\SmiMetaDataProperty.cs - - Microsoft\Data\SqlClient\Server\SmiRecordBuffer.cs - Microsoft\Data\SqlClient\Server\SmiSettersStream.cs @@ -561,9 +558,6 @@ Microsoft\Data\SqlClient\Server\SqlDataRecord.cs - - Microsoft\Data\SqlClient\Server\SqlDataRecord.netfx.cs - Microsoft\Data\SqlClient\Server\SqlMetaData.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs index 46800b4140..2b78f7d80d 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs @@ -1988,11 +1988,7 @@ internal TdsParser Parser { get { - SqlInternalConnectionTds tdsConnection = (GetOpenConnection() as SqlInternalConnectionTds); - if (tdsConnection == null) - { - throw SQL.NotAvailableOnContextConnection(); - } + SqlInternalConnectionTds tdsConnection = GetOpenTdsConnection(); return tdsConnection.Parser; } } diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs index 470cb8e35e..fc28c43938 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs @@ -1455,14 +1455,6 @@ internal static ArgumentException InvalidValue(string parameterName) { return Argument(StringsHelper.GetString(Strings.ADP_InvalidValue), parameterName); } - internal static ArgumentException InvalidMixedArgumentOfSecureCredentialAndContextConnection() - { - return ADP.Argument(StringsHelper.GetString(Strings.ADP_InvalidMixedUsageOfSecureCredentialAndContextConnection)); - } - internal static InvalidOperationException InvalidMixedUsageOfAccessTokenAndContextConnection() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.ADP_InvalidMixedUsageOfAccessTokenAndContextConnection)); - } internal static Exception InvalidMixedUsageOfAccessTokenAndCredential() { return ADP.InvalidOperation(StringsHelper.GetString(Strings.ADP_InvalidMixedUsageOfAccessTokenAndCredential)); diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs index 056d89d722..ecfbf533d6 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedGettersV3.cs @@ -63,6 +63,10 @@ internal interface ITypedGettersV3 // valid for UniqueIdentifier Guid GetGuid(int ordinal); + // valid for SqlDbType.Time + TimeSpan GetTimeSpan(int ordinal); + // valid for DateTimeOffset + DateTimeOffset GetDateTimeOffset(int ordinal); } } diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs index 4ae70725ae..1d21dc1782 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ITypedSettersV3.cs @@ -73,6 +73,10 @@ internal interface ITypedSettersV3 // valid for UniqueIdentifier void SetGuid(int ordinal, Guid value); + // valid for SqlDbType.Time + void SetTimeSpan(int ordinal, TimeSpan value); + // valid for DateTimeOffset + void SetDateTimeOffset(int ordinal, DateTimeOffset value); } } diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs index 12dda06c9f..8372b0569a 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/MemoryRecordBuffer.cs @@ -9,7 +9,7 @@ namespace Microsoft.Data.SqlClient.Server { // Class for implementing a record object used in out-of-proc scenarios. - internal sealed class MemoryRecordBuffer : SmiRecordBuffer + internal sealed class MemoryRecordBuffer : SmiTypedGetterSetter { private SqlRecordBuffer[] _buffer; @@ -25,6 +25,12 @@ internal MemoryRecordBuffer(SmiMetaData[] metaData) } } + #region Read/Write + protected override bool CanGet => true; + + protected override bool CanSet => true; + #endregion + #region Getters // Null test // valid for all types diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRecordBuffer.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRecordBuffer.cs deleted file mode 100644 index ffb1f8743a..0000000000 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiRecordBuffer.cs +++ /dev/null @@ -1,19 +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 -{ - // Class for implementing a record object that could take advantage of the - // environment available to a particular protocol level (such as storing data - // in native structures for in-proc data access). Includes methods to send - // the record to a context pipe (useful for in-proc scenarios). - internal abstract class SmiRecordBuffer : SmiTypedGetterSetter - { - // SmiRecordBuffer defaults both CanGet and CanSet to true to support - // already-shipped SMIV3 record buffer classes. Sub-classes are free to override. - protected override bool CanGet => true; - - protected override bool CanSet => true; - } -} diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs index 4bb302cd7b..6825139a15 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs @@ -14,7 +14,7 @@ namespace Microsoft.Data.SqlClient.Server /// public partial class SqlDataRecord : IDataRecord { - private readonly SmiRecordBuffer _recordBuffer; + private readonly MemoryRecordBuffer _recordBuffer; private readonly SmiExtendedMetaData[] _columnSmiMetaData; private readonly SqlMetaData[] _columnMetaData; private FieldNameLookup _fieldNameLookup; @@ -54,10 +54,22 @@ public virtual string GetDataTypeName(int ordinal) #if NET [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] #endif - public virtual Type GetFieldType(int ordinal) => GetFieldTypeFrameworkSpecific(ordinal); + public virtual Type GetFieldType(int ordinal) + { + SqlMetaData md = GetSqlMetaData(ordinal); + + #if NETFRAMEWORK + if (md.SqlDbType == SqlDbType.Udt) + { + return md.Type; + } + #endif + + return MetaType.GetMetaTypeFromSqlDbType(md.SqlDbType, isMultiValued: false).ClassType; + } /// - public virtual object GetValue(int ordinal) => GetValueFrameworkSpecific(ordinal); + public virtual object GetValue(int ordinal) => ValueUtilsSmi.GetValue200(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); /// public virtual int GetValues(object[] values) @@ -177,7 +189,7 @@ public virtual SqlMetaData GetSqlMetaData(int ordinal) public virtual Type GetSqlFieldType(int ordinal) => MetaType.GetMetaTypeFromSqlDbType(GetSqlMetaData(ordinal).SqlDbType, false).SqlType; /// - public virtual object GetSqlValue(int ordinal) => GetSqlValueFrameworkSpecific(ordinal); + public virtual object GetSqlValue(int ordinal) => ValueUtilsSmi.GetSqlValue200(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); /// public virtual int GetSqlValues(object[] values) @@ -200,10 +212,10 @@ public virtual int GetSqlValues(object[] values) public virtual SqlBinary GetSqlBinary(int ordinal) => ValueUtilsSmi.GetSqlBinary(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); /// - public virtual SqlBytes GetSqlBytes(int ordinal) => GetSqlBytesFrameworkSpecific(ordinal); + public virtual SqlBytes GetSqlBytes(int ordinal) => ValueUtilsSmi.GetSqlBytes(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); /// - public virtual SqlXml GetSqlXml(int ordinal) => GetSqlXmlFrameworkSpecific(ordinal); + public virtual SqlXml GetSqlXml(int ordinal) => ValueUtilsSmi.GetSqlXml(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); /// public virtual SqlBoolean GetSqlBoolean(int ordinal) => ValueUtilsSmi.GetSqlBoolean(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); @@ -212,7 +224,7 @@ public virtual int GetSqlValues(object[] values) public virtual SqlByte GetSqlByte(int ordinal) => ValueUtilsSmi.GetSqlByte(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); /// - public virtual SqlChars GetSqlChars(int ordinal) => GetSqlCharsFrameworkSpecific(ordinal); + public virtual SqlChars GetSqlChars(int ordinal) => ValueUtilsSmi.GetSqlChars(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); /// public virtual SqlInt16 GetSqlInt16(int ordinal) => ValueUtilsSmi.GetSqlInt16(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); @@ -246,10 +258,78 @@ public virtual int GetSqlValues(object[] values) /// // ISqlUpdateableRecord Implementation - public virtual int SetValues(params object[] values) => SetValuesFrameworkSpecific(values); + public virtual int SetValues(params object[] values) + { + if (values == null) + { + throw ADP.ArgumentNull(nameof(values)); + } + + // Allow values array longer than FieldCount, just ignore the extra cells. + int copyLength = (values.Length > FieldCount) ? FieldCount : values.Length; + + if (copyLength == 0) + { + return 0; + } + + ExtendedClrTypeCode[] typeCodes = new ExtendedClrTypeCode[copyLength]; + + // Verify all data values as acceptable before changing current state. + for (int i = 0; i < copyLength; i++) + { + SqlMetaData metaData = GetSqlMetaData(i); + typeCodes[i] = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType( + metaData.SqlDbType, + isMultiValued: false, + values[i], + metaData.Type); + if (typeCodes[i] == ExtendedClrTypeCode.Invalid) + { + throw ADP.InvalidCast(); + } + } + + // Now move the data. We've already validated the element types above, so this will + // only throw if an invalid UDT was sent. + for (int i = 0; i < copyLength; i++) + { + ValueUtilsSmi.SetCompatibleValueV200( + _recordBuffer, + ordinal: i, + GetSmiMetaData(i), + values[i], + typeCodes[i], + offset: 0, + peekAhead: null); + } + + return copyLength; + } /// - public virtual void SetValue(int ordinal, object value) => SetValueFrameworkSpecific(ordinal, value); + public virtual void SetValue(int ordinal, object value) + { + SqlMetaData metaData = GetSqlMetaData(ordinal); + ExtendedClrTypeCode typeCode = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType( + metaData.SqlDbType, + isMultiValued: false, + value, + metaData.Type); + if (typeCode == ExtendedClrTypeCode.Invalid) + { + throw ADP.InvalidCast(); + } + + ValueUtilsSmi.SetCompatibleValueV200( + _recordBuffer, + ordinal, + GetSmiMetaData(ordinal), + value, + typeCode, + offset: 0, + peekAhead: null); + } /// public virtual void SetBoolean(int ordinal, bool value) => ValueUtilsSmi.SetBoolean(_recordBuffer, ordinal, GetSmiMetaData(ordinal), value); @@ -290,10 +370,10 @@ public virtual int GetSqlValues(object[] values) public virtual void SetDateTime(int ordinal, DateTime value) => ValueUtilsSmi.SetDateTime(_recordBuffer, ordinal, GetSmiMetaData(ordinal), value); /// - public virtual void SetTimeSpan(int ordinal, TimeSpan value) => SetTimeSpanFrameworkSpecific(ordinal, value); + public virtual void SetTimeSpan(int ordinal, TimeSpan value) => ValueUtilsSmi.SetTimeSpan(_recordBuffer, ordinal, GetSmiMetaData(ordinal), value); /// - public virtual void SetDateTimeOffset(int ordinal, DateTimeOffset value) => SetDateTimeOffsetFrameworkSpecific(ordinal, value); + public virtual void SetDateTimeOffset(int ordinal, DateTimeOffset value) => ValueUtilsSmi.SetDateTimeOffset(_recordBuffer, ordinal, GetSmiMetaData(ordinal), value); /// public virtual void SetDBNull(int ordinal) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.netcore.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.netcore.cs deleted file mode 100644 index 6449aa6c62..0000000000 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.netcore.cs +++ /dev/null @@ -1,97 +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.Diagnostics.CodeAnalysis; -using Microsoft.Data.Common; - -namespace Microsoft.Data.SqlClient.Server -{ - /// - public partial class SqlDataRecord : IDataRecord - { -#if NET - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] -#endif - private Type GetFieldTypeFrameworkSpecific(int ordinal) => - MetaType.GetMetaTypeFromSqlDbType(GetSqlMetaData(ordinal).SqlDbType, false).ClassType; - - private object GetValueFrameworkSpecific(int ordinal) => - ValueUtilsSmi.GetValue200(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); - private object GetSqlValueFrameworkSpecific(int ordinal) => - ValueUtilsSmi.GetSqlValue200(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); - - private SqlBytes GetSqlBytesFrameworkSpecific(int ordinal) => - ValueUtilsSmi.GetSqlBytes(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); - - private SqlXml GetSqlXmlFrameworkSpecific(int ordinal) => - ValueUtilsSmi.GetSqlXml(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); - - private SqlChars GetSqlCharsFrameworkSpecific(int ordinal) => - ValueUtilsSmi.GetSqlChars(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); - private int SetValuesFrameworkSpecific(params object[] values) - { - if (values == null) - { - throw ADP.ArgumentNull(nameof(values)); - } - - // Allow values array longer than FieldCount, just ignore the extra cells. - int copyLength = (values.Length > FieldCount) ? FieldCount : values.Length; - - ExtendedClrTypeCode[] typeCodes = new ExtendedClrTypeCode[copyLength]; - - // Verify all data values as acceptable before changing current state. - for (int i = 0; i < copyLength; i++) - { - SqlMetaData metaData = GetSqlMetaData(i); - typeCodes[i] = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType( - metaData.SqlDbType, - isMultiValued: false, - values[i], - metaData.Type - ); - if (typeCodes[i] == ExtendedClrTypeCode.Invalid) - { - throw ADP.InvalidCast(); - } - } - - // Now move the data (it'll only throw if someone plays with the values array between - // the validation loop and here, or if an invalid UDT was sent). - for (int i = 0; i < copyLength; i++) - { - ValueUtilsSmi.SetCompatibleValueV200(_recordBuffer, i, GetSmiMetaData(i), values[i], typeCodes[i], offset: 0, peekAhead: null); - } - - return copyLength; - } - - private void SetValueFrameworkSpecific(int ordinal, object value) - { - SqlMetaData metaData = GetSqlMetaData(ordinal); - ExtendedClrTypeCode typeCode = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType( - metaData.SqlDbType, - isMultiValued: false, - value, - metaData.Type - ); - if (typeCode == ExtendedClrTypeCode.Invalid) - { - throw ADP.InvalidCast(); - } - - ValueUtilsSmi.SetCompatibleValueV200(_recordBuffer, ordinal, GetSmiMetaData(ordinal), value, typeCode, offset: 0, peekAhead: null); - } - - private void SetTimeSpanFrameworkSpecific(int ordinal, TimeSpan value) - => ValueUtilsSmi.SetTimeSpan(_recordBuffer, ordinal, GetSmiMetaData(ordinal), value); - - private void SetDateTimeOffsetFrameworkSpecific(int ordinal, DateTimeOffset value) - => ValueUtilsSmi.SetDateTimeOffset(_recordBuffer, ordinal, GetSmiMetaData(ordinal), value); - - } -} diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.netfx.cs deleted file mode 100644 index 7f67e951da..0000000000 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.netfx.cs +++ /dev/null @@ -1,132 +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 Microsoft.Data.Common; - -namespace Microsoft.Data.SqlClient.Server -{ - /// - public partial class SqlDataRecord : IDataRecord - { - private Type GetFieldTypeFrameworkSpecific(int ordinal) - { - SqlMetaData md = GetSqlMetaData(ordinal); - if (md.SqlDbType == SqlDbType.Udt) - { - return md.Type; - } - else - { - return MetaType.GetMetaTypeFromSqlDbType(md.SqlDbType, false).ClassType; - } - } - - private object GetValueFrameworkSpecific(int ordinal) - { - SmiMetaData metaData = GetSmiMetaData(ordinal); - return ValueUtilsSmi.GetValue200(_recordBuffer, ordinal, metaData); - } - - private object GetSqlValueFrameworkSpecific(int ordinal) - { - SmiMetaData metaData = GetSmiMetaData(ordinal); - return ValueUtilsSmi.GetSqlValue200(_recordBuffer, ordinal, metaData); - } - - private SqlBytes GetSqlBytesFrameworkSpecific(int ordinal) => - ValueUtilsSmi.GetSqlBytes(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); - - private SqlXml GetSqlXmlFrameworkSpecific(int ordinal) => - ValueUtilsSmi.GetSqlXml(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); - - private SqlChars GetSqlCharsFrameworkSpecific(int ordinal) => - ValueUtilsSmi.GetSqlChars(_recordBuffer, ordinal, GetSmiMetaData(ordinal)); - - private int SetValuesFrameworkSpecific(params object[] values) - { - if (values == null) - { - throw ADP.ArgumentNull(nameof(values)); - } - - // Allow values array longer than FieldCount, just ignore the extra cells. - int copyLength = (values.Length > FieldCount) ? FieldCount : values.Length; - - ExtendedClrTypeCode[] typeCodes = new ExtendedClrTypeCode[copyLength]; - - // Verify all data values as acceptable before changing current state. - for (int i = 0; i < copyLength; i++) - { - SqlMetaData metaData = GetSqlMetaData(i); - typeCodes[i] = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType( - metaData.SqlDbType, - isMultiValued: false, - values[i], - metaData.Type); - if (typeCodes[i] == ExtendedClrTypeCode.Invalid) - { - throw ADP.InvalidCast(); - } - } - - // Now move the data (it'll only throw if someone plays with the values array between - // the validation loop and here, or if an invalid UDT was sent). - for (int i = 0; i < copyLength; i++) - { - ValueUtilsSmi.SetCompatibleValueV200( - _recordBuffer, - ordinal: i, - GetSmiMetaData(i), - values[i], - typeCodes[i], - offset: 0, - peekAhead: null); - } - - return copyLength; - } - - private void SetValueFrameworkSpecific(int ordinal, object value) - { - SqlMetaData metaData = GetSqlMetaData(ordinal); - ExtendedClrTypeCode typeCode = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType( - metaData.SqlDbType, - isMultiValued: false, - value, - metaData.Type); - if (typeCode == ExtendedClrTypeCode.Invalid) - { - throw ADP.InvalidCast(); - } - - ValueUtilsSmi.SetCompatibleValueV200( - _recordBuffer, - ordinal, - GetSmiMetaData(ordinal), - value, - typeCode, - offset: 0, - peekAhead: null); - } - - private void SetTimeSpanFrameworkSpecific(int ordinal, TimeSpan value) => - ValueUtilsSmi.SetTimeSpan( - _recordBuffer, - ordinal, - GetSmiMetaData(ordinal), - value, - settersSupport2008DateTime: true); - - private void SetDateTimeOffsetFrameworkSpecific(int ordinal, DateTimeOffset value) => - ValueUtilsSmi.SetDateTimeOffset( - _recordBuffer, - ordinal, - GetSmiMetaData(ordinal), - value, - settersSupport2008DateTime: true); - } -} diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ValueUtilsSmi.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ValueUtilsSmi.cs index 39b2494fa0..72b885b7ed 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ValueUtilsSmi.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ValueUtilsSmi.cs @@ -240,7 +240,7 @@ internal static DateTime GetDateTime(ITypedGettersV3 getters, int ordinal, SmiMe } // dealing with v200 SMI - internal static DateTimeOffset GetDateTimeOffset(SmiTypedGetterSetter getters, int ordinal, SmiMetaData metaData) + internal static DateTimeOffset GetDateTimeOffset(ITypedGettersV3 getters, int ordinal, SmiMetaData metaData) { ThrowIfITypedGettersIsNull(getters, ordinal); if (CanAccessGetterDirectly(metaData, ExtendedClrTypeCode.DateTimeOffset)) @@ -851,7 +851,7 @@ internal static string GetString(ITypedGettersV3 getters, int ordinal, SmiMetaDa } // dealing with v200 SMI - internal static TimeSpan GetTimeSpan(SmiTypedGetterSetter getters, int ordinal, SmiMetaData metaData) + internal static TimeSpan GetTimeSpan(ITypedGettersV3 getters, int ordinal, SmiMetaData metaData) { ThrowIfITypedGettersIsNull(getters, ordinal); if (CanAccessGetterDirectly(metaData, ExtendedClrTypeCode.TimeSpan)) @@ -863,7 +863,7 @@ internal static TimeSpan GetTimeSpan(SmiTypedGetterSetter getters, int ordinal, // GetValue() for v200 SMI (2008 Date/Time types) internal static object GetValue200( - SmiTypedGetterSetter getters, + ITypedGettersV3 getters, int ordinal, SmiMetaData metaData) { @@ -1005,7 +1005,7 @@ internal static object GetValue( // dealing with v200 SMI internal static object GetSqlValue200( - SmiTypedGetterSetter getters, + ITypedGettersV3 getters, int ordinal, SmiMetaData metaData) { @@ -1290,14 +1290,10 @@ internal static void SetDateTime(ITypedSettersV3 setters, int ordinal, SmiMetaDa SetDateTime_Checked(setters, ordinal, metaData, value); } - internal static void SetDateTimeOffset(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, DateTimeOffset value, bool settersSupport2008DateTime = true) + internal static void SetDateTimeOffset(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, DateTimeOffset value) { - if (!settersSupport2008DateTime) - { - throw ADP.InvalidCast(); - } ThrowIfInvalidSetterAccess(metaData, ExtendedClrTypeCode.DateTimeOffset); - SetDateTimeOffset_Unchecked((SmiTypedGetterSetter)setters, ordinal, value); + SetDateTimeOffset_Unchecked(setters, ordinal, value); } internal static void SetDecimal(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, decimal value) @@ -1445,14 +1441,10 @@ internal static void SetString(ITypedSettersV3 setters, int ordinal, SmiMetaData SetString_LengthChecked(setters, ordinal, metaData, value, 0); } - internal static void SetTimeSpan(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, TimeSpan value, bool settersSupport2008DateTime = true) + internal static void SetTimeSpan(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, TimeSpan value) { - if (!settersSupport2008DateTime) - { - throw ADP.InvalidCast(); - } ThrowIfInvalidSetterAccess(metaData, ExtendedClrTypeCode.TimeSpan); - SetTimeSpan_Checked((SmiTypedGetterSetter)setters, ordinal, metaData, value); + SetTimeSpan_Checked(setters, ordinal, metaData, value); } // Implements SqlClient 2.0-compatible SetValue() semantics @@ -1502,7 +1494,7 @@ value is DataFeed SetDateTime_Checked(setters, ordinal, metaData, ((DateOnly)value).ToDateTime(new TimeOnly(0, 0))); break; case ExtendedClrTypeCode.TimeOnly: - SetTimeSpan_Checked((SmiTypedGetterSetter)setters, ordinal, metaData, ((TimeOnly)value).ToTimeSpan()); + SetTimeSpan_Checked(setters, ordinal, metaData, ((TimeOnly)value).ToTimeSpan()); break; #endif case ExtendedClrTypeCode.DateTime: @@ -2150,7 +2142,7 @@ private static void SetDateTime_Checked(ITypedSettersV3 setters, int ordinal, Sm SetDateTime_Unchecked(setters, ordinal, (metaData.SqlDbType == SqlDbType.Date) ? value.Date : value); } - private static void SetTimeSpan_Checked(SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, TimeSpan value) + private static void SetTimeSpan_Checked(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, TimeSpan value) { VerifyTimeRange(metaData.SqlDbType, value); SetTimeSpan_Unchecked(setters, ordinal, value); @@ -2260,7 +2252,7 @@ private static void SetBytes_FromRecord(ITypedSettersV3 setters, int ordinal, Sm setters.SetBytesLength(ordinal, currentOffset); } - private static void SetBytes_FromReader(SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) + private static void SetBytes_FromReader(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) { // Deal with large values by sending bufferLength of NoLengthLimit (== assume // CheckXetParameters will ignore requested-length checks in this case) @@ -2365,7 +2357,7 @@ private static void SetChars_FromRecord(ITypedSettersV3 setters, int ordinal, Sm // Transfer a character value from a reader when we're not sure which GetXXX method the reader will support. // Prefers to chunk data via GetChars, but falls back to GetString if that fails. // Mainly put in place because DataTableReader doesn't support GetChars on string columns, but others could fail too... - private static void SetCharsOrString_FromReader(SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) + private static void SetCharsOrString_FromReader(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) { bool success = false; try @@ -2388,7 +2380,7 @@ private static void SetCharsOrString_FromReader(SmiTypedGetterSetter setters, in } // Use chunking via SetChars to transfer a value from a reader to a gettersetter - private static void SetChars_FromReader(SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) + private static void SetChars_FromReader(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) { // Deal with large values by sending bufferLength of NoLengthLimit (== assume // CheckXetParameters will ignore requested-length checks in this case) @@ -2429,7 +2421,7 @@ private static void SetChars_FromReader(SmiTypedGetterSetter setters, int ordina setters.SetCharsLength(ordinal, currentOffset); } - private static void SetString_FromReader(SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) + private static void SetString_FromReader(ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) { string value = reader.GetString(ordinal); int length = CheckXetParameters(metaData.SqlDbType, metaData.MaxLength, value.Length, fieldOffset: 0, bufferLength: NoLengthLimit, bufferOffset: offset, length: NoLengthLimit); @@ -2888,7 +2880,7 @@ private static DateTime GetDateTime_Unchecked(ITypedGettersV3 getters, int ordin return result; } - private static DateTimeOffset GetDateTimeOffset_Unchecked(SmiTypedGetterSetter getters, int ordinal) + private static DateTimeOffset GetDateTimeOffset_Unchecked(ITypedGettersV3 getters, int ordinal) { Debug.Assert(!IsDBNull_Unchecked(getters, ordinal)); @@ -2995,7 +2987,7 @@ private static string GetString_Unchecked(ITypedGettersV3 getters, int ordinal) return result; } - private static TimeSpan GetTimeSpan_Unchecked(SmiTypedGetterSetter getters, int ordinal) + private static TimeSpan GetTimeSpan_Unchecked(ITypedGettersV3 getters, int ordinal) { Debug.Assert(!IsDBNull_Unchecked(getters, ordinal)); @@ -3132,12 +3124,12 @@ private static void SetDate_Unchecked(ITypedSettersV3 setters, int ordinal, SmiM setters.SetDateTime(ordinal, value); } - private static void SetTimeSpan_Unchecked(SmiTypedGetterSetter setters, int ordinal, TimeSpan value) + private static void SetTimeSpan_Unchecked(ITypedSettersV3 setters, int ordinal, TimeSpan value) { setters.SetTimeSpan(ordinal, value); } - private static void SetDateTimeOffset_Unchecked(SmiTypedGetterSetter setters, int ordinal, DateTimeOffset value) + private static void SetDateTimeOffset_Unchecked(ITypedSettersV3 setters, int ordinal, DateTimeOffset value) { setters.SetDateTimeOffset(ordinal, value); } diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs index 06564633e8..94df331f22 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs @@ -1073,11 +1073,6 @@ internal static TransactionPromotionException PromotionFailed(Exception inner) return e; } - internal static Exception SqlDepCannotBeCreatedInProc() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SqlNotify_SqlDepCannotBeCreatedInProc)); - } - static internal Exception SqlNotificationException(SqlNotificationEventArgs notify) { return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQLNotify_ErrorFormat, notify.Type, notify.Info, notify.Source)); @@ -1165,77 +1160,6 @@ internal static Exception IEnumerableOfSqlDataRecordHasNoRows() return ADP.Argument(StringsHelper.GetString(Strings.IEnumerableOfSqlDataRecordHasNoRows)); } - // - // SqlPipe - // - internal static Exception SqlPipeCommandHookedUpToNonContextConnection() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SqlPipe_CommandHookedUpToNonContextConnection)); - } - - internal static Exception SqlPipeMessageTooLong(int messageLength) - { - return ADP.Argument(StringsHelper.GetString(Strings.SqlPipe_MessageTooLong, messageLength)); - } - - internal static Exception SqlPipeIsBusy() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SqlPipe_IsBusy)); - } - - internal static Exception SqlPipeAlreadyHasAnOpenResultSet(string methodName) - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SqlPipe_AlreadyHasAnOpenResultSet, methodName)); - } - - internal static Exception SqlPipeDoesNotHaveAnOpenResultSet(string methodName) - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SqlPipe_DoesNotHaveAnOpenResultSet, methodName)); - } - - // - // : ISqlResultSet - // - internal static Exception SqlResultSetClosed(string methodname) - { - if (methodname == null) - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_SqlResultSetClosed2)); - } - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_SqlResultSetClosed, methodname)); - } - internal static Exception SqlResultSetNoData(string methodname) - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.ADP_DataReaderNoData, methodname)); - } - internal static Exception SqlRecordReadOnly(string methodname) - { - if (methodname == null) - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_SqlRecordReadOnly2)); - } - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_SqlRecordReadOnly, methodname)); - } - - internal static Exception SqlResultSetRowDeleted(string methodname) - { - if (methodname == null) - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_SqlResultSetRowDeleted2)); - } - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_SqlResultSetRowDeleted, methodname)); - } - - internal static Exception SqlResultSetCommandNotInSameConnection() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_SqlResultSetCommandNotInSameConnection)); - } - - internal static Exception SqlResultSetNoAcceptableCursor() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_SqlResultSetNoAcceptableCursor)); - } - // // SQL.BulkLoad // @@ -1607,10 +1531,6 @@ internal static Exception UnsupportedFeatureAndToken(SqlInternalConnectionTds in return exc; } - internal static Exception BatchedUpdatesNotAvailableOnContextConnection() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_BatchedUpdatesNotAvailableOnContextConnection)); - } internal static Exception Azure_ManagedIdentityException(string msg) { SqlErrorCollection errors = new SqlErrorCollection @@ -2411,48 +2331,17 @@ internal static Exception EmptyProviderName() // Merged Provider // - static internal Exception ContextAllowsLimitedKeywords() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ContextAllowsLimitedKeywords)); - } - static internal Exception ContextAllowsOnlyTypeSystem2005() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ContextAllowsOnlyTypeSystem2005)); - } - static internal Exception ContextConnectionIsInUse() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ContextConnectionIsInUse)); - } static internal Exception ContextConnectionIsUnsupported() { return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ContextConnectionIsUnsupported)); } - static internal Exception ContextUnavailableOutOfProc() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ContextUnavailableOutOfProc)); - } - static internal Exception ContextUnavailableWhileInProc() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ContextUnavailableWhileInProc)); - } + static internal Exception NestedTransactionScopesNotSupported() { return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_NestedTransactionScopesNotSupported)); } - static internal Exception NotAvailableOnContextConnection() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_NotAvailableOnContextConnection)); - } - static internal Exception NotificationsNotAvailableOnContextConnection() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_NotificationsNotAvailableOnContextConnection)); - } // @TODO: Check these methods for usage - static internal Exception UserInstanceNotAvailableInProc() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_UserInstanceNotAvailableInProc)); - } static internal Exception ArgumentLengthMismatch(string arg1, string arg2) { return ADP.Argument(StringsHelper.GetString(Strings.SQL_ArgumentLengthMismatch, arg1, arg2)); @@ -2461,10 +2350,6 @@ static internal Exception InvalidSqlDbTypeOneAllowedType(SqlDbType invalidType, { return ADP.Argument(StringsHelper.GetString(Strings.SQL_InvalidSqlDbTypeWithOneAllowedType, invalidType, method, allowedType)); } - static internal Exception SqlPipeErrorRequiresSendEnd() - { - return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_PipeErrorRequiresSendEnd)); - } static internal Exception TooManyValues(string arg) { return ADP.Argument(StringsHelper.GetString(Strings.SQL_TooManyValues), arg); diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsRecordBufferSetter.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsRecordBufferSetter.cs index 496295e0b8..cae885c67c 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsRecordBufferSetter.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsRecordBufferSetter.cs @@ -11,7 +11,7 @@ namespace Microsoft.Data.SqlClient { // TdsRecordBufferSetter handles writing a structured value out to a TDS stream - internal class TdsRecordBufferSetter : SmiRecordBuffer + internal class TdsRecordBufferSetter : SmiTypedGetterSetter { #region Fields (private) diff --git a/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs b/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs index b41b331db7..b17b0a1750 100644 --- a/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs +++ b/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs @@ -438,15 +438,6 @@ internal static string ADP_DataReaderClosed { } } - /// - /// Looks up a localized string similar to No data exists for the row/column.. - /// - internal static string ADP_DataReaderNoData { - get { - return ResourceManager.GetString("ADP_DataReaderNoData", resourceCulture); - } - } - /// /// Looks up a localized string similar to DB concurrency violation.. /// @@ -879,15 +870,6 @@ internal static string ADP_InvalidMixedUsageOfAccessTokenAndAuthentication { } } - /// - /// Looks up a localized string similar to Cannot set the AccessToken property with the 'Context Connection' keyword.. - /// - internal static string ADP_InvalidMixedUsageOfAccessTokenAndContextConnection { - get { - return ResourceManager.GetString("ADP_InvalidMixedUsageOfAccessTokenAndContextConnection", resourceCulture); - } - } - /// /// Looks up a localized string similar to Cannot set the AccessToken property if the Credential property is already set.. /// @@ -960,15 +942,6 @@ internal static string ADP_InvalidMixedUsageOfSecureAndClearCredential { } } - /// - /// Looks up a localized string similar to Cannot use Credential with Context Connection keyword.. - /// - internal static string ADP_InvalidMixedUsageOfSecureCredentialAndContextConnection { - get { - return ResourceManager.GetString("ADP_InvalidMixedUsageOfSecureCredentialAndContextConnection", resourceCulture); - } - } - /// /// Looks up a localized string similar to Cannot use Credential with Integrated Security connection string keyword.. /// @@ -9101,15 +9074,6 @@ internal static string SQL_AuthenticationAndIntegratedSecurity { } } - /// - /// Looks up a localized string similar to Batching updates is not supported on the context connection.. - /// - internal static string SQL_BatchedUpdatesNotAvailableOnContextConnection { - get { - return ResourceManager.GetString("SQL_BatchedUpdatesNotAvailableOnContextConnection", resourceCulture); - } - } - /// /// Looks up a localized string similar to SqlBulkCopy.WriteToServer failed because the SqlBulkCopy.DestinationTableName is an invalid multipart name. /// @@ -9451,34 +9415,7 @@ internal static string SQL_ConnectionLockedForBcpEvent { return ResourceManager.GetString("SQL_ConnectionLockedForBcpEvent", resourceCulture); } } - - /// - /// Looks up a localized string similar to The only additional connection string keyword that may be used when requesting the context connection is the Type System Version keyword.. - /// - internal static string SQL_ContextAllowsLimitedKeywords { - get { - return ResourceManager.GetString("SQL_ContextAllowsLimitedKeywords", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The context connection does not support Type System Version=SQL Server 2000.. - /// - internal static string SQL_ContextAllowsOnlyTypeSystem2005 { - get { - return ResourceManager.GetString("SQL_ContextAllowsOnlyTypeSystem2005", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The context connection is already in use.. - /// - internal static string SQL_ContextConnectionIsInUse { - get { - return ResourceManager.GetString("SQL_ContextConnectionIsInUse", resourceCulture); - } - } - + /// /// Looks up a localized string similar to Connecting to the context connection using Microsoft.Data.SqlClient is not supported.. /// @@ -9487,24 +9424,7 @@ internal static string SQL_ContextConnectionIsUnsupported { return ResourceManager.GetString("SQL_ContextConnectionIsUnsupported", resourceCulture); } } - - /// - /// Looks up a localized string similar to The requested operation requires a SqlClr context, which is only available when running in the Sql Server process.. - /// - internal static string SQL_ContextUnavailableOutOfProc { - get { - return ResourceManager.GetString("SQL_ContextUnavailableOutOfProc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The requested operation requires a Sql Server execution thread. The current thread was started by user code or other non-Sql Server engine code.. - /// - internal static string SQL_ContextUnavailableWhileInProc { - get { - return ResourceManager.GetString("SQL_ContextUnavailableWhileInProc", resourceCulture); - } - } + /// /// Looks up a localized string similar to Either Credential or both 'User ID' and 'Password' (or 'UID' and 'PWD') connection string keywords must be specified, if 'Authentication={0}'.. @@ -10001,24 +9921,6 @@ internal static string SQL_NonXmlResult { } } - /// - /// Looks up a localized string similar to The requested operation is not available on the context connection.. - /// - internal static string SQL_NotAvailableOnContextConnection { - get { - return ResourceManager.GetString("SQL_NotAvailableOnContextConnection", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Notifications are not available on the context connection.. - /// - internal static string SQL_NotificationsNotAvailableOnContextConnection { - get { - return ResourceManager.GetString("SQL_NotificationsNotAvailableOnContextConnection", resourceCulture); - } - } - /// /// Looks up a localized string similar to Notifications require SQL Server 9.0 or later.. /// @@ -10199,15 +10101,6 @@ internal static string SQL_PendingBeginXXXExists { } } - /// - /// Looks up a localized string similar to An error occurred with a prior row sent to the SqlPipe. SendResultsEnd must be called before anything else can be sent.. - /// - internal static string SQL_PipeErrorRequiresSendEnd { - get { - return ResourceManager.GetString("SQL_PipeErrorRequiresSendEnd", resourceCulture); - } - } - /// /// Looks up a localized string similar to Precision value '{0}' is either less than 0 or greater than the maximum allowed precision of 38.. /// @@ -10388,78 +10281,6 @@ internal static string SQL_SqlCommandCommandText { } } - /// - /// Looks up a localized string similar to '{0}' cannot be called when the record is read only.. - /// - internal static string SQL_SqlRecordReadOnly { - get { - return ResourceManager.GetString("SQL_SqlRecordReadOnly", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Operation cannot be completed because the record is read only.. - /// - internal static string SQL_SqlRecordReadOnly2 { - get { - return ResourceManager.GetString("SQL_SqlRecordReadOnly2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid attempt to call method {0} when SqlResultSet is closed.. - /// - internal static string SQL_SqlResultSetClosed { - get { - return ResourceManager.GetString("SQL_SqlResultSetClosed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Operation cannot be completed because the SqlResultSet is closed.. - /// - internal static string SQL_SqlResultSetClosed2 { - get { - return ResourceManager.GetString("SQL_SqlResultSetClosed2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Operation cannot be completed because the command that created the SqlResultSet has been dissociated from the original connection. SqlResultSet is closed.. - /// - internal static string SQL_SqlResultSetCommandNotInSameConnection { - get { - return ResourceManager.GetString("SQL_SqlResultSetCommandNotInSameConnection", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to SqlResultSet could not be created for the given query with the desired options.. - /// - internal static string SQL_SqlResultSetNoAcceptableCursor { - get { - return ResourceManager.GetString("SQL_SqlResultSetNoAcceptableCursor", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid attempt to call method {0} when the current row is deleted. - /// - internal static string SQL_SqlResultSetRowDeleted { - get { - return ResourceManager.GetString("SQL_SqlResultSetRowDeleted", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Operation cannot be completed because the current row is deleted. - /// - internal static string SQL_SqlResultSetRowDeleted2 { - get { - return ResourceManager.GetString("SQL_SqlResultSetRowDeleted2", resourceCulture); - } - } - /// /// Looks up a localized string similar to '{0}' cannot be called when the SqlDataRecord is read only.. /// @@ -10811,15 +10632,6 @@ internal static string SQL_UserInstanceFailure { } } - /// - /// Looks up a localized string similar to User instances are not allowed when running in the Sql Server process.. - /// - internal static string SQL_UserInstanceNotAvailableInProc { - get { - return ResourceManager.GetString("SQL_UserInstanceNotAvailableInProc", resourceCulture); - } - } - /// /// Looks up a localized string similar to Invalid attempt to get vector data from column '{0}'. Vectors are only supported for columns of type vector.. /// @@ -11757,15 +11569,6 @@ internal static string SQLNotify_ErrorFormat { } } - /// - /// Looks up a localized string similar to SqlDependency object cannot be created when running inside the SQL Server process.. - /// - internal static string SqlNotify_SqlDepCannotBeCreatedInProc { - get { - return ResourceManager.GetString("SqlNotify_SqlDepCannotBeCreatedInProc", resourceCulture); - } - } - /// /// Looks up a localized string similar to DBNull value for parameter '{0}' is not supported. Table-valued parameters cannot be DBNull.. /// @@ -11874,51 +11677,6 @@ internal static string SqlParameter_XmlSchemaCollectionOwningSchema { } } - /// - /// Looks up a localized string similar to A result set is currently being sent to the pipe. End the current result set before calling {0}.. - /// - internal static string SqlPipe_AlreadyHasAnOpenResultSet { - get { - return ResourceManager.GetString("SqlPipe_AlreadyHasAnOpenResultSet", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to SqlPipe does not support executing a command with a connection that is not a context connection.. - /// - internal static string SqlPipe_CommandHookedUpToNonContextConnection { - get { - return ResourceManager.GetString("SqlPipe_CommandHookedUpToNonContextConnection", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Result set has not been initiated. Call SendResultSetStart before calling {0}.. - /// - internal static string SqlPipe_DoesNotHaveAnOpenResultSet { - get { - return ResourceManager.GetString("SqlPipe_DoesNotHaveAnOpenResultSet", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not use the pipe while it is busy with another operation.. - /// - internal static string SqlPipe_IsBusy { - get { - return ResourceManager.GetString("SqlPipe_IsBusy", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Message length {0} exceeds maximum length supported of 4000.. - /// - internal static string SqlPipe_MessageTooLong { - get { - return ResourceManager.GetString("SqlPipe_MessageTooLong", resourceCulture); - } - } - /// /// Looks up a localized string similar to The sort ordinal {0} was specified twice.. /// diff --git a/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx b/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx index 90a157876a..1e903b8a79 100644 --- a/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx +++ b/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx @@ -231,18 +231,12 @@ Cannot use Credential with Integrated Security connection string keyword. - - Cannot use Credential with Context Connection keyword. - Cannot set the AccessToken property if 'UserID', 'UID', 'Password', or 'PWD' has been specified in connection string. Cannot set the AccessToken property if the 'Integrated Security' connection string keyword has been set to 'true' or 'SSPI'. - - Cannot set the AccessToken property with the 'Context Connection' keyword. - Cannot set the AccessToken property if the Credential property is already set. @@ -2073,9 +2067,6 @@ Invalid destination buffer (size of {0}) offset: {1} - - No data exists for the row/column. - The numerical value is too large to fit into a 96 bit decimal. @@ -2778,30 +2769,6 @@ Data length '{0}' is less than 0. - - Invalid attempt to call method {0} when SqlResultSet is closed. - - - Operation cannot be completed because the SqlResultSet is closed. - - - '{0}' cannot be called when the record is read only. - - - Operation cannot be completed because the record is read only. - - - Invalid attempt to call method {0} when the current row is deleted - - - Operation cannot be completed because the current row is deleted - - - Operation cannot be completed because the command that created the SqlResultSet has been dissociated from the original connection. SqlResultSet is closed. - - - SqlResultSet could not be created for the given query with the desired options. - '{0}' cannot be called when the SqlDataRecord is read only. @@ -2871,51 +2838,21 @@ The currently loaded System.Transactions.dll does not support Global Transactions. Please upgrade to .NET Framework 4.6.2 or later. - - Batching updates is not supported on the context connection. - - - The only additional connection string keyword that may be used when requesting the context connection is the Type System Version keyword. - - - The context connection does not support Type System Version=SQL Server 2000. - Connecting to the context connection using Microsoft.Data.SqlClient is not supported. - - The context connection is already in use. - - - The requested operation requires a SqlClr context, which is only available when running in the Sql Server process. - - - The requested operation requires a Sql Server execution thread. The current thread was started by user code or other non-Sql Server engine code. - Nested TransactionScopes are not supported. - - The requested operation is not available on the context connection. - - - Notifications are not available on the context connection. - Unexpected server event: {0}. - - User instances are not allowed when running in the Sql Server process. - The length of '{0}' must match the length of '{1}'. The SqlDbType '{0}' is invalid for {1}. Only {2} is supported. - - An error occurred with a prior row sent to the SqlPipe. SendResultsEnd must be called before anything else can be sent. - Too many values. @@ -3663,9 +3600,6 @@ This SqlCommand object is already associated with another SqlDependency object. - - SqlDependency object cannot be created when running inside the SQL Server process. - The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use notifications. @@ -3726,21 +3660,6 @@ There are no records in the SqlDataRecord enumeration. To send a table-valued parameter with no rows, use a null reference for the value instead. - - SqlPipe does not support executing a command with a connection that is not a context connection. - - - Message length {0} exceeds maximum length supported of 4000. - - - Could not use the pipe while it is busy with another operation. - - - A result set is currently being sent to the pipe. End the current result set before calling {0}. - - - Result set has not been initiated. Call SendResultSetStart before calling {0}. - HTTP Provider