Create database task helper uses current db instead of default (#584)

This commit is contained in:
Matt Irvine
2018-03-16 13:37:04 -07:00
committed by GitHub
parent aaa3513db2
commit 2c7de499d1
2 changed files with 7 additions and 3 deletions

View File

@@ -217,6 +217,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
false, false,
connectionDetails.UserName, connectionDetails.UserName,
passwordSecureString, passwordSecureString,
connectionDetails.DatabaseName,
xmlDoc.InnerXml); xmlDoc.InnerXml);
} }
else else
@@ -227,6 +228,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
true, true,
null, null,
null, null,
connectionDetails.DatabaseName,
xmlDoc.InnerXml); xmlDoc.InnerXml);
} }

View File

@@ -684,7 +684,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
/// <param name="userName">User name for not trusted connections</param> /// <param name="userName">User name for not trusted connections</param>
/// <param name="password">Password for not trusted connections</param> /// <param name="password">Password for not trusted connections</param>
/// <param name="xmlParameters">XML string with parameters</param> /// <param name="xmlParameters">XML string with parameters</param>
public CDataContainer(ServerType serverType, string serverName, bool trusted, string userName, SecureString password, string xmlParameters) public CDataContainer(ServerType serverType, string serverName, bool trusted, string userName, SecureString password, string databaseName, string xmlParameters)
{ {
this.serverType = serverType; this.serverType = serverType;
this.serverName = serverName; this.serverName = serverName;
@@ -692,7 +692,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
if (serverType == ServerType.SQL) if (serverType == ServerType.SQL)
{ {
//does some extra initialization //does some extra initialization
ApplyConnectionInfo(GetTempSqlConnectionInfoWithConnection(serverName, trusted, userName, password), true); ApplyConnectionInfo(GetTempSqlConnectionInfoWithConnection(serverName, trusted, userName, password, databaseName), true);
//NOTE: ServerConnection property will constuct the object if needed //NOTE: ServerConnection property will constuct the object if needed
m_server = new Server(ServerConnection); m_server = new Server(ServerConnection);
@@ -1031,7 +1031,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
string serverName, string serverName,
bool trusted, bool trusted,
string userName, string userName,
SecureString password) SecureString password,
string databaseName)
{ {
SqlConnectionInfoWithConnection tempCI = new SqlConnectionInfoWithConnection(serverName); SqlConnectionInfoWithConnection tempCI = new SqlConnectionInfoWithConnection(serverName);
tempCI.SingleConnection = false; tempCI.SingleConnection = false;
@@ -1047,6 +1048,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
tempCI.UserName = userName; tempCI.UserName = userName;
tempCI.SecurePassword = password; tempCI.SecurePassword = password;
} }
tempCI.DatabaseName = databaseName;
return tempCI; return tempCI;
} }