From f7dcaa38ff523ab7f49040368095a243c45945c4 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 31 Oct 2018 16:13:09 -0700 Subject: [PATCH] fix for issue 3065 (#3067) * fix for 3065 * remove the parameter, no need to save connection --- .../commandLine/common/commandLineService.ts | 36 +++++++++---------- .../common/connectionManagementService.ts | 11 +++--- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/sql/parts/commandLine/common/commandLineService.ts b/src/sql/parts/commandLine/common/commandLineService.ts index 08c6f9dc50..e9d9c53935 100644 --- a/src/sql/parts/commandLine/common/commandLineService.ts +++ b/src/sql/parts/commandLine/common/commandLineService.ts @@ -17,18 +17,17 @@ import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectEx import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; export class CommandLineService implements ICommandLineProcessing { - private _connectionProfile : ConnectionProfile; + private _connectionProfile: ConnectionProfile; private _showConnectionDialog: boolean; constructor( - @IConnectionManagementService private _connectionManagementService : IConnectionManagementService, - @ICapabilitiesService private _capabilitiesService : ICapabilitiesService, - @IEnvironmentService private _environmentService : IEnvironmentService, - @IQueryEditorService private _queryEditorService : IQueryEditorService, - @IObjectExplorerService private _objectExplorerService : IObjectExplorerService, - @IEditorService private _editorService : IEditorService, - ) - { + @IConnectionManagementService private _connectionManagementService: IConnectionManagementService, + @ICapabilitiesService private _capabilitiesService: ICapabilitiesService, + @IEnvironmentService private _environmentService: IEnvironmentService, + @IQueryEditorService private _queryEditorService: IQueryEditorService, + @IObjectExplorerService private _objectExplorerService: IObjectExplorerService, + @IEditorService private _editorService: IEditorService, + ) { let profile = null; if (this._environmentService && this._environmentService.args.server) { profile = new ConnectionProfile(_capabilitiesService, null); @@ -38,7 +37,7 @@ export class CommandLineService implements ICommandLineProcessing { profile.serverName = _environmentService.args.server; profile.databaseName = _environmentService.args.database ? _environmentService.args.database : ''; profile.userName = _environmentService.args.user ? _environmentService.args.user : ''; - profile.authenticationType = _environmentService.args.integrated ? 'Integrated' : 'SqlLogin'; + profile.authenticationType = _environmentService.args.integrated ? 'Integrated' : 'SqlLogin'; profile.connectionName = ''; profile.setOptionValue('applicationName', Constants.applicationName); profile.setOptionValue('databaseDisplayName', profile.databaseName); @@ -46,14 +45,13 @@ export class CommandLineService implements ICommandLineProcessing { } this._connectionProfile = profile; const registry = platform.Registry.as(ConnectionProviderExtensions.ConnectionProviderContributions); - let sqlProvider = registry.getProperties( Constants.mssqlProviderName); + let sqlProvider = registry.getProperties(Constants.mssqlProviderName); // We can't connect to object explorer until the MSSQL connection provider is registered if (sqlProvider) { this.processCommandLine(); } else { registry.onNewProvider(e => { - if (e.id === Constants.mssqlProviderName) - { + if (e.id === Constants.mssqlProviderName) { this.processCommandLine(); } }); @@ -64,14 +62,14 @@ export class CommandLineService implements ICommandLineProcessing { if (!this._connectionProfile && !this._connectionManagementService.hasRegisteredServers()) { // prompt the user for a new connection on startup if no profiles are registered this._connectionManagementService.showConnectionDialog(); - } else if (this._connectionProfile) { + } else if (this._connectionProfile) { this._connectionManagementService.connectIfNotConnected(this._connectionProfile, 'connection') .then(result => TaskUtilities.newQuery(this._connectionProfile, - this._connectionManagementService, - this._queryEditorService, - this._objectExplorerService, - this._editorService)) - .catch(() => {}); + this._connectionManagementService, + this._queryEditorService, + this._objectExplorerService, + this._editorService)) + .catch(() => { }); } } } \ No newline at end of file diff --git a/src/sql/parts/connection/common/connectionManagementService.ts b/src/sql/parts/connection/common/connectionManagementService.ts index 5d925f59b9..2d468afe31 100644 --- a/src/sql/parts/connection/common/connectionManagementService.ts +++ b/src/sql/parts/connection/common/connectionManagementService.ts @@ -381,12 +381,11 @@ export class ConnectionManagementService extends Disposable implements IConnecti resolve(this._connectionStatusManager.getOriginalOwnerUri(ownerUri)); } else { const options: IConnectionCompletionOptions = { - // Should saving the connection be a command line switch? - saveTheConnection : true, - showConnectionDialogOnError : true, - showDashboard : purpose === 'dashboard', - params : undefined, - showFirewallRuleOnError : true, + saveTheConnection: false, + showConnectionDialogOnError: true, + showDashboard: purpose === 'dashboard', + params: undefined, + showFirewallRuleOnError: true, }; this.connect(connection, ownerUri, options).then(connectionResult => { if (connectionResult && connectionResult.connected) {