Supporting SQL DW in Object explorer (#380)

* supporting sql dw in oe
This commit is contained in:
Leila Lali
2017-06-15 12:53:32 -07:00
committed by GitHub
parent d9e68831ab
commit 71b349f67b
20 changed files with 544 additions and 152 deletions

View File

@@ -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);
}
}
}
}

View File

@@ -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