Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlErrorCollection.cs">
<Link>Microsoft\Data\SqlClient\SqlErrorCollection.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlEnvChange.cs">
<Link>Microsoft\Data\SqlClient\SqlEnvChange.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlException.cs">
<Link>Microsoft\Data\SqlClient\SqlException.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1994,36 +1994,36 @@ internal bool IgnoreEnvChange
internal void OnEnvChange(SqlEnvChange rec)
{
Debug.Assert(!IgnoreEnvChange, "This function should not be called if IgnoreEnvChange is set!");
switch (rec.type)
switch (rec._type)
{
case TdsEnums.ENV_DATABASE:
// If connection is not open and recovery is not in progress, store the server value as the original.
if (!_fConnectionOpen && _recoverySessionData == null)
{
_originalDatabase = rec.newValue;
_originalDatabase = rec._newValue;
}

CurrentDatabase = rec.newValue;
CurrentDatabase = rec._newValue;
break;

case TdsEnums.ENV_LANG:
// If connection is not open and recovery is not in progress, store the server value as the original.
if (!_fConnectionOpen && _recoverySessionData == null)
{
_originalLanguage = rec.newValue;
_originalLanguage = rec._newValue;
}

_currentLanguage = rec.newValue;
_currentLanguage = rec._newValue;
break;

case TdsEnums.ENV_PACKETSIZE:
_currentPacketSize = int.Parse(rec.newValue, CultureInfo.InvariantCulture);
_currentPacketSize = int.Parse(rec._newValue, CultureInfo.InvariantCulture);
break;

case TdsEnums.ENV_COLLATION:
if (_currentSessionData != null)
{
_currentSessionData._collation = rec.newCollation;
_currentSessionData._collation = rec._newCollation;
}
break;

Expand All @@ -2043,20 +2043,20 @@ internal void OnEnvChange(SqlEnvChange rec)
{
throw SQL.ROR_FailoverNotSupportedServer(this);
}
_currentFailoverPartner = rec.newValue;
_currentFailoverPartner = rec._newValue;
break;

case TdsEnums.ENV_PROMOTETRANSACTION:
byte[] dtcToken = null;
if (rec.newBinRented)
byte[] dtcToken;
if (rec._newBinRented)
{
dtcToken = new byte[rec.newLength];
Buffer.BlockCopy(rec.newBinValue, 0, dtcToken, 0, dtcToken.Length);
dtcToken = new byte[rec._newLength];
Buffer.BlockCopy(rec._newBinValue, 0, dtcToken, 0, dtcToken.Length);
}
else
{
dtcToken = rec.newBinValue;
rec.newBinValue = null;
dtcToken = rec._newBinValue;
rec._newBinValue = null;
}
PromotedDTCToken = dtcToken;
break;
Expand All @@ -2077,16 +2077,16 @@ internal void OnEnvChange(SqlEnvChange rec)
break;

case TdsEnums.ENV_USERINSTANCE:
_instanceName = rec.newValue;
_instanceName = rec._newValue;
break;

case TdsEnums.ENV_ROUTING:
SqlClientEventSource.Log.TryAdvancedTraceEvent("<sc.SqlInternalConnectionTds.OnEnvChange|ADV> {0}, Received routing info", ObjectID);
if (string.IsNullOrEmpty(rec.newRoutingInfo.ServerName) || rec.newRoutingInfo.Protocol != 0 || rec.newRoutingInfo.Port == 0)
if (string.IsNullOrEmpty(rec._newRoutingInfo.ServerName) || rec._newRoutingInfo.Protocol != 0 || rec._newRoutingInfo.Port == 0)
{
throw SQL.ROR_InvalidRoutingInfo(this);
}
RoutingInfo = rec.newRoutingInfo;
RoutingInfo = rec._newRoutingInfo;
break;

default:
Expand Down
Loading