Skip to content

Commit

Permalink
Commented out Debugger directives.
Browse files Browse the repository at this point in the history
Fixed detection of sql connection type
  • Loading branch information
zapacila89 committed May 19, 2020
1 parent 59910fa commit 18c1bb2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
4 changes: 2 additions & 2 deletions HuntingDog/DogEngine/Impl/StudioController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ public void ModifyProcedure(IServer server, Entity entityObject)
{
this.SafeRun(() =>
{
System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();
//System.Diagnostics.Debugger.Launch();
//System.Diagnostics.Debugger.Break();
var serverInfo = GetServer(server);
serverInfo.Connection.DatabaseName = entityObject.DatabaseName;
ManagementStudioController.OpenStoredProcedureForModification(entityObject.InternalObject as StoredProcedure, serverInfo.Connection, _cfg.AlterOrCreate);
Expand Down
49 changes: 33 additions & 16 deletions HuntingDog/Engine/ManagementStudioController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Text;
Expand Down Expand Up @@ -196,22 +197,38 @@ public static void OpenFunctionForModification(UserDefinedFunction userDefinedFu

private static UIConnectionInfo CreateFrom(SqlConnectionInfo connInfo)
{
System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();

var ci = new UIConnectionInfo();
ci.ServerName = connInfo.ServerName;
ci.ServerType = new Guid("8c91a03d-f9b4-46c0-a305-b5dcc79ff907");
ci.UserName = connInfo.UserName;
ci.Password = connInfo.Password;
ci.PersistPassword = true;
ci.ApplicationName = "Microsoft SQL Server Management Studio - Query";

ci.AuthenticationType = (int) (connInfo.UseIntegratedSecurity
? SqlConnectionInfo.AuthenticationMethod.NotSpecified
: connInfo.Authentication);

return ci;
//System.Diagnostics.Debugger.Launch();
//System.Diagnostics.Debugger.Break();

var authMethod = SqlConnectionInfo.AuthenticationMethod.NotSpecified;

if (!connInfo.UseIntegratedSecurity)
{
if (connInfo.Authentication != SqlConnectionInfo.AuthenticationMethod.NotSpecified)
authMethod = connInfo.Authentication;
else if(!string.IsNullOrEmpty(connInfo.UserName) && !string.IsNullOrEmpty(connInfo.Password))
{
// Note: For some reason, auth type is set as not specified for SqlPassword.
authMethod = SqlConnectionInfo.AuthenticationMethod.SqlPassword;
}
}

var ci = new UIConnectionInfo
{
ServerName = connInfo.ServerName,
ServerType = new Guid("8c91a03d-f9b4-46c0-a305-b5dcc79ff907"),
UserName = connInfo.UserName,
Password = connInfo.Password,
PersistPassword = true,
ApplicationName = "Microsoft SQL Server Management Studio - Query",
AuthenticationType = (int)authMethod,
ServerVersion = connInfo.ServerVersion,
OtherParams = connInfo.AdditionalParameters,
RenewableToken = connInfo.AccessToken,
InMemoryPassword = connInfo.SecurePassword,
};

return ci;
}

public static void ListDependency(SqlConnectionInfo connInfo, StoredProcedure sp, Database db)
Expand Down

0 comments on commit 18c1bb2

Please sign in to comment.