mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Remove BDC backwards compat check (#873)
* Remove BDC backwards compat check * Fix merge issues
This commit is contained in:
@@ -824,29 +824,26 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection
|
|||||||
serverInfo.Options = new Dictionary<string, object>();
|
serverInfo.Options = new Dictionary<string, object>();
|
||||||
|
|
||||||
// Get BDC endpoints
|
// Get BDC endpoints
|
||||||
if (!serverInfo.IsCloud)
|
if (!serverInfo.IsCloud && serverInfo.ServerMajorVersion >= 15)
|
||||||
{
|
{
|
||||||
if (serverInfo.ServerMajorVersion >= 15)
|
List<ClusterEndpoint> clusterEndpoints = new List<ClusterEndpoint>();
|
||||||
{
|
serverInfo.Options.Add(ServerInfo.OptionClusterEndpoints, clusterEndpoints);
|
||||||
List<ClusterEndpoint> clusterEndpoints = new List<ClusterEndpoint>();
|
|
||||||
serverInfo.Options.Add(ServerInfo.OptionClusterEndpoints, clusterEndpoints);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
|
||||||
LookupClusterEndpoints(connection, serverInfo, clusterEndpoints);
|
|
||||||
}
|
|
||||||
catch (SqlException)
|
|
||||||
{
|
|
||||||
// Failed to find cluster endpoints DMV / table, this must not be a cluster
|
|
||||||
// or user does not have permissions to see cluster info
|
|
||||||
serverInfo.Options.Add(ServerInfo.OptionIsBigDataCluster, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
LookupClusterEndpoints(connection, serverInfo, clusterEndpoints);
|
||||||
|
}
|
||||||
|
catch (SqlException)
|
||||||
|
{
|
||||||
|
// Failed to find cluster endpoints DMV, this must not be a cluster
|
||||||
|
// or user does not have permissions to see cluster info
|
||||||
serverInfo.Options.Add(ServerInfo.OptionIsBigDataCluster, false);
|
serverInfo.Options.Add(ServerInfo.OptionIsBigDataCluster, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serverInfo.Options.Add(ServerInfo.OptionIsBigDataCluster, false);
|
||||||
|
}
|
||||||
|
|
||||||
return serverInfo;
|
return serverInfo;
|
||||||
};
|
};
|
||||||
@@ -868,44 +865,23 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection
|
|||||||
|
|
||||||
private static void LookupClusterEndpoints(IDbConnection connection, ServerInfo serverInfo, List<ClusterEndpoint> clusterEndpoints)
|
private static void LookupClusterEndpoints(IDbConnection connection, ServerInfo serverInfo, List<ClusterEndpoint> clusterEndpoints)
|
||||||
{
|
{
|
||||||
try
|
ExecuteReader(
|
||||||
{
|
connection,
|
||||||
ExecuteReader(
|
SqlConnectionHelperScripts.GetClusterEndpoints,
|
||||||
connection,
|
delegate (IDataReader reader)
|
||||||
SqlConnectionHelperScripts.GetClusterEndpoints,
|
{
|
||||||
delegate (IDataReader reader)
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
while (reader.Read())
|
clusterEndpoints.Add(new ClusterEndpoint {
|
||||||
{
|
ServiceName = reader.GetString(0),
|
||||||
clusterEndpoints.Add(new ClusterEndpoint {
|
Description = reader.GetString(1),
|
||||||
ServiceName = reader.GetString(0),
|
Endpoint = reader.GetString(2),
|
||||||
Description = reader.GetString(1),
|
Protocol = reader.GetString(3)
|
||||||
Endpoint = reader.GetString(2),
|
});
|
||||||
Protocol = reader.GetString(3)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
serverInfo.Options.Add(ServerInfo.OptionIsBigDataCluster, clusterEndpoints.Count > 0);
|
|
||||||
}
|
}
|
||||||
);
|
serverInfo.Options.Add(ServerInfo.OptionIsBigDataCluster, clusterEndpoints.Count > 0);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
);
|
||||||
{
|
|
||||||
// Fallback to using previous CTP logic.
|
|
||||||
// TODO #847 remove this logic once we've stopped supporting CTPs
|
|
||||||
ExecuteReader(
|
|
||||||
connection,
|
|
||||||
SqlConnectionHelperScripts.GetClusterEndpoints_CTP,
|
|
||||||
delegate (IDataReader reader)
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
clusterEndpoints.Add(new ClusterEndpoint { ServiceName = reader.GetString(0), IpAddress = reader.GetString(1), Port = reader.GetInt32(2) });
|
|
||||||
}
|
|
||||||
serverInfo.Options.Add(ServerInfo.OptionIsBigDataCluster, clusterEndpoints.Count > 0);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetServerName(IDbConnection connection)
|
public static string GetServerName(IDbConnection connection)
|
||||||
|
|||||||
@@ -47,12 +47,6 @@ SELECT @filepath AS FilePath
|
|||||||
";
|
";
|
||||||
|
|
||||||
public const string GetOsVersion = @"SELECT OSVersion = RIGHT(@@version, LEN(@@version)- 3 -charindex (' on ', LOWER(@@version)))";
|
public const string GetOsVersion = @"SELECT OSVersion = RIGHT(@@version, LEN(@@version)- 3 -charindex (' on ', LOWER(@@version)))";
|
||||||
// TODO: #847 remove the Throw condition from endpoints query when removing the GetClusterEndpoints_CTP code.
|
public const string GetClusterEndpoints = @"SELECT [name], [description], [endpoint], [protocol_desc] FROM .[sys].[dm_cluster_endpoints];";
|
||||||
// This is needed for 1 monthly release, to support back compatibility with CTP 3.2
|
|
||||||
public const string GetClusterEndpoints = @"IF OBJECT_ID (N'sys.dm_cluster_endpoints') IS NOT NULL
|
|
||||||
SELECT [name], [description], [endpoint], [protocol_desc] FROM .[sys].[dm_cluster_endpoints];
|
|
||||||
ELSE THROW 50000, 'Use older DMV', 1";
|
|
||||||
public const string GetClusterEndpoints_CTP = @"IF OBJECT_ID (N'master.dbo.cluster_endpoint_info') IS NOT NULL
|
|
||||||
SELECT [service_name], [ip_address], [port] FROM [master].[dbo].[cluster_endpoint_info];";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user