Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding TDS8 version for TDSLogin #1657

Merged
merged 12 commits into from
Jul 23, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ internal sealed partial class TdsParser

private bool _is2012 = false;

private bool _is2022 = false;

private byte[][] _sniSpnBuffer = null;

// SqlStatistics
Expand Down Expand Up @@ -322,7 +324,7 @@ private bool IncludeTraceHeader
{
get
{
return (_is2012 && SqlClientEventSource.Log.IsEnabled());
return (_is2022 && SqlClientEventSource.Log.IsEnabled());
JRahnama marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -3639,10 +3641,17 @@ private bool TryProcessLoginAck(TdsParserStateObject stateObj, out SqlLoginAck s
}
_is2012 = true;
break;
case (uint)TdsEnums.SQL2022_MAJOR << 24 | TdsEnums.SQL2022_MINOR:
if (increment != TdsEnums.SQL2022_INCREMENT)
{
throw SQL.InvalidTDSVersion();
}
_is2022 = true;
break;
default:
throw SQL.InvalidTDSVersion();
}

_is2012 |= _is2022;
_is2008 |= _is2012;
_is2005 |= _is2008;

Expand Down Expand Up @@ -8112,7 +8121,7 @@ internal void TdsLogin(SqlLogin rec, TdsEnums.FeatureExtension requestedFeatures
WriteInt(length, _physicalStateObj);
if (recoverySessionData == null)
{
WriteInt((TdsEnums.SQL2012_MAJOR << 24) | (TdsEnums.SQL2012_INCREMENT << 16) | TdsEnums.SQL2012_MINOR, _physicalStateObj);
WriteInt((TdsEnums.SQL2022_MAJOR << 24) | (TdsEnums.SQL2022_INCREMENT << 16) | TdsEnums.SQL2022_MINOR, _physicalStateObj);
David-Engel marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ internal static void Assert(string message)

private bool _is2012 = false;

private bool _is2022 = false;

private byte[] _sniSpnBuffer = null;

// UNDONE - need to have some for both instances - both command and default???
Expand Down Expand Up @@ -459,7 +461,7 @@ private bool IncludeTraceHeader
{
get
{
return (_is2012 && SqlClientEventSource.Log.IsEnabled());
return (_is2022 && SqlClientEventSource.Log.IsEnabled());
JRahnama marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -4125,10 +4127,16 @@ private bool TryProcessLoginAck(TdsParserStateObject stateObj, out SqlLoginAck s
{ throw SQL.InvalidTDSVersion(); }
_is2012 = true;
break;
case (uint)TdsEnums.SQL2022_MAJOR << 24 | TdsEnums.SQL2022_MINOR:
if (increment != TdsEnums.SQL2022_INCREMENT)
{ throw SQL.InvalidTDSVersion(); }
_is2022 = true;
break;
default:
throw SQL.InvalidTDSVersion();
}

_is2012 |= _is2022;
_is2008 |= _is2012;
_is2005 |= _is2008;
_is2000SP1 |= _is2005; // includes all lower versions
Expand Down Expand Up @@ -8989,7 +8997,7 @@ internal void TdsLogin(SqlLogin rec,
WriteInt(length, _physicalStateObj);
if (recoverySessionData == null)
{
WriteInt((TdsEnums.SQL2012_MAJOR << 24) | (TdsEnums.SQL2012_INCREMENT << 16) | TdsEnums.SQL2012_MINOR, _physicalStateObj);
WriteInt((TdsEnums.SQL2022_MAJOR << 24) | (TdsEnums.SQL2022_INCREMENT << 16) | TdsEnums.SQL2022_MINOR, _physicalStateObj);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,19 +347,22 @@ public enum ActiveDirectoryWorkflow : byte
public const int SQL2005_MAJOR = 0x72; // the high-byte is sufficient to distinguish later versions
public const int SQL2008_MAJOR = 0x73;
public const int SQL2012_MAJOR = 0x74;
public const int SQL2022_MAJOR = 0x80;
public const string TDS8_Protocol = "tds/8.0"; //TDS8

// Increments:
public const int SQL2000SP1_INCREMENT = 0x00;
public const int SQL2005_INCREMENT = 0x09;
public const int SQL2008_INCREMENT = 0x0b;
public const int SQL2012_INCREMENT = 0x00;
public const int SQL2022_INCREMENT = 0x00;

// Minors:
public const int SQL2000SP1_MINOR = 0x0001;
public const int SQL2005_RTM_MINOR = 0x0002;
public const int SQL2008_MINOR = 0x0003;
public const int SQL2012_MINOR = 0x0004;
public const int SQL2022_MINOR = 0x0005;

public const int ORDER_68000 = 1;
public const int USE_DB_ON = 1;
Expand Down