@@ -105,8 +105,6 @@ internal sealed partial class TdsParser
105
105
106
106
// Version variables
107
107
108
- private bool _is2005 = false; // set to true if speaking to 2005 or later
109
-
110
108
private bool _is2008 = false;
111
109
112
110
private bool _is2012 = false;
@@ -931,7 +929,6 @@ private PreLoginHandshakeStatus ConsumePreLoginHandshake(
931
929
// Assign default values
932
930
marsCapable = _fMARS;
933
931
fedAuthRequired = false;
934
- bool is2005OrLater = false;
935
932
Debug.Assert(_physicalStateObj._syncOverAsync, "Should not attempt pends in a synchronous call");
936
933
TdsOperationStatus result = _physicalStateObj.TryReadNetworkPacket();
937
934
if (result != TdsOperationStatus.Done)
@@ -990,13 +987,6 @@ private PreLoginHandshakeStatus ConsumePreLoginHandshake(
990
987
byte minorVersion = payload[payloadOffset + 1];
991
988
int level = (payload[payloadOffset + 2] << 8) |
992
989
payload[payloadOffset + 3];
993
-
994
- is2005OrLater = majorVersion >= 9;
995
- if (!is2005OrLater)
996
- {
997
- marsCapable = false; // If pre-2005, MARS not supported.
998
- }
999
-
1000
990
break;
1001
991
1002
992
case (int)PreLoginOptions.ENCRYPT:
@@ -1154,7 +1144,7 @@ private PreLoginHandshakeStatus ConsumePreLoginHandshake(
1154
1144
bool shouldValidateServerCert = (_encryptionOption == EncryptionOptions.ON && !trustServerCert) ||
1155
1145
(_connHandler._accessTokenInBytes != null && !trustServerCert);
1156
1146
uint info = (shouldValidateServerCert ? TdsEnums.SNI_SSL_VALIDATE_CERTIFICATE : 0)
1157
- | (is2005OrLater ? TdsEnums.SNI_SSL_USE_SCHANNEL_CACHE : 0) ;
1147
+ | TdsEnums.SNI_SSL_USE_SCHANNEL_CACHE;
1158
1148
1159
1149
EnableSsl(info, encrypt, integratedSecurity, serverCert);
1160
1150
}
@@ -2747,30 +2737,7 @@ private TdsOperationStatus TryProcessEnvChange(int tokenLength, TdsParserStateOb
2747
2737
}
2748
2738
break;
2749
2739
2750
- case TdsEnums.ENV_CHARSET:
2751
- // we copied this behavior directly from luxor - see charset envchange
2752
- // section from sqlctokn.c
2753
- result = TryReadTwoStringFields(env, stateObj);
2754
- if (result != TdsOperationStatus.Done)
2755
- {
2756
- return result;
2757
- }
2758
- if (env._newValue == TdsEnums.DEFAULT_ENGLISH_CODE_PAGE_STRING)
2759
- {
2760
- _defaultCodePage = TdsEnums.DEFAULT_ENGLISH_CODE_PAGE_VALUE;
2761
- _defaultEncoding = System.Text.Encoding.GetEncoding(_defaultCodePage);
2762
- }
2763
- else
2764
- {
2765
- Debug.Assert(env._newValue.Length > TdsEnums.CHARSET_CODE_PAGE_OFFSET, "TdsParser.ProcessEnvChange(): charset value received with length <=10");
2766
-
2767
- string stringCodePage = env._newValue.Substring(TdsEnums.CHARSET_CODE_PAGE_OFFSET);
2768
-
2769
- _defaultCodePage = int.Parse(stringCodePage, NumberStyles.Integer, CultureInfo.InvariantCulture);
2770
- _defaultEncoding = System.Text.Encoding.GetEncoding(_defaultCodePage);
2771
- }
2772
-
2773
- break;
2740
+ // TdsEnums.ENV_CHARSET (3) is only supported in TDS <= 7 which is no longer supported
2774
2741
2775
2742
case TdsEnums.ENV_PACKETSIZE:
2776
2743
// take care of packet size right here
@@ -2802,24 +2769,9 @@ private TdsOperationStatus TryProcessEnvChange(int tokenLength, TdsParserStateOb
2802
2769
2803
2770
break;
2804
2771
2805
- case TdsEnums.ENV_LOCALEID:
2806
- // UNDONE: this LCID may be incorrect for OEM code pages on 7.0
2807
- // need a way to get lcid from code page
2808
- result = TryReadTwoStringFields(env, stateObj);
2809
- if (result != TdsOperationStatus.Done)
2810
- {
2811
- return result;
2812
- }
2813
- _defaultLCID = int.Parse(env._newValue, NumberStyles.Integer, CultureInfo.InvariantCulture);
2814
- break;
2772
+ // TdsEnums.ENV_LOCALE (5) is only supported in TDS <= 7 which is no longer supported
2815
2773
2816
- case TdsEnums.ENV_COMPFLAGS:
2817
- result = TryReadTwoStringFields(env, stateObj);
2818
- if (result != TdsOperationStatus.Done)
2819
- {
2820
- return result;
2821
- }
2822
- break;
2774
+ // TdsEnums.ENV_COMPFLAGS (6) is only supported in TDS <= 7 which is no longer supported
2823
2775
2824
2776
case TdsEnums.ENV_COLLATION:
2825
2777
Debug.Assert(env._newLength == 5 || env._newLength == 0, "Improper length in new collation!");
@@ -3829,7 +3781,6 @@ private TdsOperationStatus TryProcessLoginAck(TdsParserStateObject stateObj, out
3829
3781
{
3830
3782
throw SQL.InvalidTDSVersion();
3831
3783
}
3832
- _is2005 = true;
3833
3784
break;
3834
3785
case TdsEnums.SQL2008_MAJOR << 24 | TdsEnums.SQL2008_MINOR:
3835
3786
if (increment != TdsEnums.SQL2008_INCREMENT)
@@ -3857,7 +3808,6 @@ private TdsOperationStatus TryProcessLoginAck(TdsParserStateObject stateObj, out
3857
3808
}
3858
3809
_is2012 |= _is2022;
3859
3810
_is2008 |= _is2012;
3860
- _is2005 |= _is2008;
3861
3811
3862
3812
stateObj._outBytesUsed = stateObj._outputHeaderLen;
3863
3813
byte len;
@@ -5178,7 +5128,7 @@ private TdsOperationStatus TryProcessTypeInfo(TdsParserStateObject stateObj, Sql
5178
5128
}
5179
5129
5180
5130
// read the collation for 7.x servers
5181
- if (col.metaType.IsCharType && (tdsType != TdsEnums.SQLXMLTYPE) && (( tdsType != TdsEnums.SQLJSON) ))
5131
+ if (col.metaType.IsCharType && (tdsType != TdsEnums.SQLXMLTYPE) && (tdsType != TdsEnums.SQLJSON))
5182
5132
{
5183
5133
result = TryProcessCollation(stateObj, out col.collation);
5184
5134
if (result != TdsOperationStatus.Done)
@@ -9431,8 +9381,7 @@ internal Task TdsExecuteRPC(SqlCommand cmd, IList<_SqlRPC> rpcArray, int timeout
9431
9381
continue;
9432
9382
}
9433
9383
9434
- if ((!_is2005 && !mt.Is80Supported) ||
9435
- (!_is2008 && !mt.Is90Supported))
9384
+ if (!_is2008 && !mt.Is90Supported)
9436
9385
{
9437
9386
throw ADP.VersionDoesNotSupportDataType(mt.TypeName);
9438
9387
}
@@ -9797,8 +9746,6 @@ private Task TDSExecuteRPCAddParameter(TdsParserStateObject stateObj, SqlParamet
9797
9746
}
9798
9747
else if (mt.SqlDbType == SqlDbType.Udt)
9799
9748
{
9800
- Debug.Assert(_is2005, "Invalid DataType UDT for non-2005 or later server!");
9801
-
9802
9749
int maxSupportedSize = Is2008OrNewer ? int.MaxValue : short.MaxValue;
9803
9750
byte[] udtVal = null;
9804
9751
SqlServer.Server.Format format = SqlServer.Server.Format.Native;
@@ -9891,7 +9838,7 @@ private Task TDSExecuteRPCAddParameter(TdsParserStateObject stateObj, SqlParamet
9891
9838
else if ((!mt.IsVarTime) && (mt.SqlDbType != SqlDbType.Date))
9892
9839
{ // Time, Date, DateTime2, DateTimeoffset do not have the size written out
9893
9840
maxsize = (size > actualSize) ? size : actualSize;
9894
- if (maxsize == 0 && _is2005 )
9841
+ if (maxsize == 0)
9895
9842
{
9896
9843
// 2005 doesn't like 0 as MaxSize. Change it to 2 for unicode types (SQL9 - 682322)
9897
9844
if (mt.IsNCharType)
@@ -11224,8 +11171,6 @@ private int GetNotificationHeaderSize(SqlNotificationRequest notificationRequest
11224
11171
// Write query notificaiton header data, not including the notificaiton header length
11225
11172
private void WriteQueryNotificationHeaderData(SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj)
11226
11173
{
11227
- Debug.Assert(_is2005, "WriteQueryNotificationHeaderData called on a non-2005 server");
11228
-
11229
11174
// We may need to update the notification header length if the header is changed in the future
11230
11175
11231
11176
Debug.Assert(notificationRequest != null, "notificationRequest is null");
@@ -13284,16 +13229,15 @@ private TdsOperationStatus TryProcessUDTMetaData(SqlMetaDataPriv metaData, TdsPa
13284
13229
+ " _connHandler = {14}\n\t"
13285
13230
+ " _fMARS = {15}\n\t"
13286
13231
+ " _sessionPool = {16}\n\t"
13287
- + " _is2005 = {17}\n\t"
13288
- + " _sniSpnBuffer = {18}\n\t"
13289
- + " _errors = {19}\n\t"
13290
- + " _warnings = {20}\n\t"
13291
- + " _attentionErrors = {21}\n\t"
13292
- + " _attentionWarnings = {22}\n\t"
13293
- + " _statistics = {23}\n\t"
13294
- + " _statisticsIsInTransaction = {24}\n\t"
13295
- + " _fPreserveTransaction = {25}"
13296
- + " _fParallel = {26}"
13232
+ + " _sniSpnBuffer = {17}\n\t"
13233
+ + " _errors = {18}\n\t"
13234
+ + " _warnings = {19}\n\t"
13235
+ + " _attentionErrors = {20}\n\t"
13236
+ + " _attentionWarnings = {21}\n\t"
13237
+ + " _statistics = {22}\n\t"
13238
+ + " _statisticsIsInTransaction = {23}\n\t"
13239
+ + " _fPreserveTransaction = {24}"
13240
+ + " _fParallel = {25}"
13297
13241
;
13298
13242
internal string TraceString()
13299
13243
{
@@ -13316,7 +13260,6 @@ internal string TraceString()
13316
13260
_connHandler == null ? "(null)" : _connHandler.ObjectID.ToString((IFormatProvider)null),
13317
13261
_fMARS ? bool.TrueString : bool.FalseString,
13318
13262
_sessionPool == null ? "(null)" : _sessionPool.TraceString(),
13319
- _is2005 ? bool.TrueString : bool.FalseString,
13320
13263
_serverSpn == null ? "(null)" : _serverSpn.Length.ToString((IFormatProvider)null),
13321
13264
_physicalStateObj != null ? "(null)" : _physicalStateObj.ErrorCount.ToString((IFormatProvider)null),
13322
13265
_physicalStateObj != null ? "(null)" : _physicalStateObj.WarningCount.ToString((IFormatProvider)null),
0 commit comments