Added grouping between system/user dbs when listing (#70)

This commit is contained in:
Mitchell Sternke
2016-09-29 11:57:28 -07:00
committed by GitHub
parent 3777cceb57
commit 3f77e14347

View File

@@ -202,10 +202,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
// try to get information about the connected SQL Server instance
try
{
var connection = connectionInfo.SqlConnection as ReliableSqlConnection;
if (connection != null)
{
ReliableConnectionHelper.ServerInfo serverInfo = ReliableConnectionHelper.GetServerVersion(connection.GetUnderlyingConnection());
var reliableConnection = connectionInfo.SqlConnection as ReliableSqlConnection;
DbConnection connection = reliableConnection != null ? reliableConnection.GetUnderlyingConnection() : connectionInfo.SqlConnection;
ReliableConnectionHelper.ServerInfo serverInfo = ReliableConnectionHelper.GetServerVersion(connection);
response.ServerInfo = new Contracts.ServerInfo()
{
ServerMajorVersion = serverInfo.ServerMajorVersion,
@@ -220,7 +220,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
OsVersion = serverInfo.OsVersion
};
}
}
catch(Exception ex)
{
response.Messages = ex.ToString();
@@ -291,7 +290,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
connection.Open();
DbCommand command = connection.CreateCommand();
command.CommandText = "SELECT name FROM sys.databases";
command.CommandText = "SELECT name FROM sys.databases ORDER BY database_id ASC";
command.CommandTimeout = 15;
command.CommandType = CommandType.Text;
var reader = command.ExecuteReader();