From 19597360786da6d814ce144f415a221ba058c506 Mon Sep 17 00:00:00 2001 From: Vasu Bhog Date: Fri, 20 May 2022 13:47:53 -0700 Subject: [PATCH] fix loop for cancelling out databases (#19460) * fix loop for cancelling out databases * remove loop and comments --- .../src/common/azureFunctionsUtils.ts | 52 +++++++++---------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/extensions/sql-bindings/src/common/azureFunctionsUtils.ts b/extensions/sql-bindings/src/common/azureFunctionsUtils.ts index 7679166243..c2af28f004 100644 --- a/extensions/sql-bindings/src/common/azureFunctionsUtils.ts +++ b/extensions/sql-bindings/src/common/azureFunctionsUtils.ts @@ -323,35 +323,31 @@ export async function promptForObjectName(bindingType: BindingType, connectionIn let connectionURI: string | undefined; let selectedDatabase: string | undefined; - while (true) { - if (!connectionInfo) { - // prompt is shown when user selects an existing connection string setting - // or manually enters a connection string - return promptToManuallyEnterObjectName(bindingType); - } - - // TODO create path to solve for selectView (first need to support views as well) - // Prompt user to select a table based on connection profile and selected database} - // get connectionURI and selectedDatabase to be used for listing tables query request - connectionURI = await getConnectionURI(connectionInfo); - if (!connectionURI) { - // User cancelled or mssql connection error - // we will then prompt user to choose a connection profile again - continue; - } - selectedDatabase = await promptSelectDatabase(connectionURI); - if (!selectedDatabase) { - // User cancelled - // we will then prompt user to choose a connection profile again - continue; - } - - connectionInfo.database = selectedDatabase; - - let selectedObjectName = await promptSelectTable(connectionURI, bindingType, selectedDatabase); - - return selectedObjectName; + if (!connectionInfo) { + // prompt is shown when user selects an existing connection string setting + // or manually enters a connection string + return promptToManuallyEnterObjectName(bindingType); } + + // TODO create path to solve for selectView (first need to support views as well) + // Prompt user to select a table based on connection profile and selected database} + // get connectionURI and selectedDatabase to be used for listing tables query request + connectionURI = await getConnectionURI(connectionInfo); + if (!connectionURI) { + // mssql connection error + return undefined; + } + selectedDatabase = await promptSelectDatabase(connectionURI); + if (!selectedDatabase) { + // User cancelled + return undefined; + } + + connectionInfo.database = selectedDatabase; + + let selectedObjectName = await promptSelectTable(connectionURI, bindingType, selectedDatabase); + + return selectedObjectName; } /**