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

@@ -15,6 +15,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
/// Property name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Indicates which platforms a filter is valid for
/// </summary>

View File

@@ -1,96 +0,0 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
{
/// <summary>
/// Server Types
/// </summary>
public enum SqlServerType
{
Unknown,
Sql2005,
Sql2008,
Sql2012,
Sql2014,
Sql2016,
Sql2017,
Azure,
AzureV12
}
/// <summary>
/// Includes helper functions for server version and type
/// </summary>
public class ServerVersionHelper
{
/// <summary>
/// Converts a server type to ValidForFlag
/// </summary>
public static ValidForFlag GetValidForFlag(SqlServerType serverType)
{
ValidForFlag validforFlag = ValidForFlag.All;
if (Enum.TryParse<ValidForFlag>(serverType.ToString(), out validforFlag))
{
return validforFlag;
}
return ValidForFlag.All;
}
/// <summary>
/// Creates a server type from the server version
/// </summary>
public static SqlServerType CalculateServerType(ServerInfo serverInfo)
{
SqlServerType serverType = SqlServerType.Unknown;
string serverVersion = serverInfo.ServerVersion;
if (serverInfo.IsCloud)
{
if (serverVersion.StartsWith("11", StringComparison.Ordinal))
{
serverType = SqlServerType.Azure;
}
else
{
serverType = SqlServerType.AzureV12;
}
}
else if (!string.IsNullOrWhiteSpace(serverVersion))
{
if (serverVersion.StartsWith("9", StringComparison.Ordinal) ||
serverVersion.StartsWith("09", StringComparison.Ordinal))
{
serverType = SqlServerType.Sql2005;
}
else if (serverVersion.StartsWith("10", StringComparison.Ordinal))
{
serverType = SqlServerType.Sql2008; // and 2008R2
}
else if (serverVersion.StartsWith("11", StringComparison.Ordinal))
{
serverType = SqlServerType.Sql2012;
}
else if (serverVersion.StartsWith("12", StringComparison.Ordinal))
{
serverType = SqlServerType.Sql2014;
}
else if (serverVersion.StartsWith("13", StringComparison.Ordinal))
{
serverType = SqlServerType.Sql2016;
}
else if (serverVersion.StartsWith("14", StringComparison.Ordinal))
{
serverType = SqlServerType.Sql2017;
}
}
return serverType;
}
}
}

View File

@@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
{
/// <summary>
/// Indicates which type of server a given node type is valid for
/// </summary>
[Flags]
public enum ValidForFlag
{
Sql2005 = 0x01,
Sql2008 = 0x02,
Sql2012 = 0x04,
Sql2014 = 0x08,
Azure = 0x10,
AzureV12 = 0x20,
Sql2016 = 0x40,
Sql2017 = 0x80,
AllOnPrem = Sql2005 | Sql2008 | Sql2012 | Sql2014 | Sql2016 | Sql2017,
AllAzure = Azure | AzureV12,
All = Sql2005 | Sql2008 | Sql2012 | Sql2014 | Sql2016 | Sql2017 | Azure | AzureV12
}
}