mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-26 01:25:42 -05:00
@@ -404,7 +404,7 @@ SET NUMERIC_ROUNDABORT OFF;";
|
||||
switch (e.CurrentState)
|
||||
{
|
||||
case ConnectionState.Open:
|
||||
RetreiveSessionId();
|
||||
RetrieveSessionId();
|
||||
break;
|
||||
case ConnectionState.Broken:
|
||||
case ConnectionState.Closed:
|
||||
@@ -418,20 +418,24 @@ SET NUMERIC_ROUNDABORT OFF;";
|
||||
}
|
||||
}
|
||||
|
||||
private void RetreiveSessionId()
|
||||
private void RetrieveSessionId()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (IDbCommand command = CreateReliableCommand())
|
||||
{
|
||||
command.CommandText = QueryAzureSessionId;
|
||||
object result = command.ExecuteScalar();
|
||||
|
||||
// Only returns a session id for SQL Azure
|
||||
if (DBNull.Value != result)
|
||||
IDbConnection connection = command.Connection;
|
||||
if (!IsSqlDwConnection(connection))
|
||||
{
|
||||
string sessionId = (string)command.ExecuteScalar();
|
||||
_azureSessionId = new Guid(sessionId);
|
||||
command.CommandText = QueryAzureSessionId;
|
||||
object result = command.ExecuteScalar();
|
||||
|
||||
// Only returns a session id for SQL Azure
|
||||
if (DBNull.Value != result)
|
||||
{
|
||||
string sessionId = (string)command.ExecuteScalar();
|
||||
_azureSessionId = new Guid(sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,15 +342,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection
|
||||
/// <param name="azureSessionId"></param>
|
||||
internal static void RaiseSchemaAmbientRetryMessage(RetryState retryState, int errorCode, Guid azureSessionId)
|
||||
{
|
||||
Logger.Write(LogLevel.Warning, string.Format(
|
||||
"Retry occurred: session: {0}; attempt - {1}; delay - {2}; exception - \"{3}\"",
|
||||
azureSessionId,
|
||||
retryState.RetryCount,
|
||||
retryState.Delay,
|
||||
retryState.LastError
|
||||
));
|
||||
if (azureSessionId != Guid.Empty)
|
||||
{
|
||||
Logger.Write(LogLevel.Warning, string.Format(
|
||||
"Retry occurred: session: {0}; attempt - {1}; delay - {2}; exception - \"{3}\"",
|
||||
azureSessionId,
|
||||
retryState.RetryCount,
|
||||
retryState.Delay,
|
||||
retryState.LastError
|
||||
));
|
||||
|
||||
RaiseAmbientRetryMessage(retryState, errorCode);
|
||||
RaiseAmbientRetryMessage(retryState, errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
#region ProcessNetLibErrorCode enumeration
|
||||
|
||||
Reference in New Issue
Block a user