Add changeConnectionUri action for query (#1227)

* added wip rename query

* added first rename test

* added missing query handling and two new tests

* removed ServiceDispose

* added change to owneruri.

* made fields private, used accessor methods

* added readonly flag back

* added didSave to sqltools.servicelayer

* fix for docsavecallbacks

* removed tryremove

* test disconnect in queryExecutionService

* removed debug message working query.

* added comment to handlerenamerequest

* added uri replacement function

* removed duplicate removemap function

* added minor fixes

* changed connectionOwnerUri to getter setter

* removed handledidsave and added setters

* removed additional save parts

* fixed space issues

* more fixes for spaces

* restored spaces

* fixed workspaceservice

* Update TextDocument.cs

* changed renameRequest into notification WIP

* restored textdocument

* restored textdocument.cs

* added rightwards arrow

* renamed rename to ChangeConnectionUri

* added more renames

* rename changeconnectionuri to changeuri

* renamed file names

* Revert "renamed file names"

This reverts commit 55228e65025b5179b15ae9a0adc095d95538723d.

* Revert "rename changeconnectionuri to changeuri"

This reverts commit 23f3813f609e3947f103e057f7c0919184075bdc.

* removed logging message and other small changes

* renamed class and method
This commit is contained in:
Alex Ma
2021-08-30 11:06:07 -07:00
committed by GitHub
parent 5d5debbad6
commit 431e4cfbf1
7 changed files with 169 additions and 1 deletions

View File

@@ -766,6 +766,22 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
return false;
}
/// <summary>
/// Reassign the uri associated with a connection info with a new uri.
/// </summary>
public bool ReplaceUri(string originalOwnerUri, string newOwnerUri)
{
// Lookup the ConnectionInfo owned by the URI
ConnectionInfo info;
if (!OwnerToConnectionMap.TryGetValue(originalOwnerUri, out info))
{
return false;
}
OwnerToConnectionMap.Remove(originalOwnerUri);
OwnerToConnectionMap.Add(newOwnerUri, info);
return true;
}
/// <summary>
/// Close a connection with the specified connection details.
/// </summary>