Handle some server properties not being supported for certain SQL versions (#24587)

* Co-authored-by: Benjin Dubishar <benjind@microsoft.com>
This commit is contained in:
Cory Rivera
2023-10-09 13:28:08 -07:00
committed by GitHub
parent a3041f25b2
commit 63a78e62aa
7 changed files with 132 additions and 118 deletions

View File

@@ -1,6 +1,6 @@
{
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
"version": "4.10.0.4",
"version": "4.10.0.14",
"downloadFileNames": {
"Windows_86": "win-x86-net7.0.zip",
"Windows_64": "win-x64-net7.0.zip",

View File

@@ -544,7 +544,7 @@ export enum AffinityType {
}
export interface Server extends ObjectManagement.SqlObject {
hardwareGeneration: string;
hardwareGeneration?: string;
language: string;
memoryInMB: number;
operatingSystem: string;
@@ -553,14 +553,14 @@ export interface Server extends ObjectManagement.SqlObject {
version: string;
isClustered: boolean;
isHadrEnabled: boolean;
isPolyBaseInstalled: boolean;
isXTPSupported: boolean;
isPolyBaseInstalled?: boolean;
isXTPSupported?: boolean;
product: string;
reservedStorageSizeMB: number;
reservedStorageSizeMB?: number;
rootDirectory: string;
serverCollation: string;
serviceTier: string;
storageSpaceUsageInMB: number;
serviceTier?: string;
storageSpaceUsageInMB?: number;
minServerMemory: NumericServerProperty;
maxServerMemory: NumericServerProperty;
autoProcessorAffinityMaskForAll: boolean;

View File

@@ -10,6 +10,7 @@ import { IObjectManagementService } from 'mssql';
import * as localizedConstants from '../localizedConstants';
import * as constants from '../constants';
import { Server, ServerViewInfo, NumaNode, AffinityType, ServerLoginMode, AuditLevel } from '../interfaces';
import { isUndefinedOrNull } from '../../types';
const Dialog_Width = '750px';
@@ -157,6 +158,19 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
}
private initializeGeneralSection(): void {
// Information about the platform that the SQL instance is running on
let platformItems: azdata.Component[] = [];
if (this.objectInfo.hardwareGeneration) {
this.hardwareGenerationInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.HardwareGenerationText,
inputType: 'text',
enabled: this.options.isNewObject,
value: this.objectInfo.hardwareGeneration.toString()
});
const hardwareGenerationContainer = this.createLabelInputContainer(localizedConstants.HardwareGenerationText, this.hardwareGenerationInput);
platformItems.push(hardwareGenerationContainer);
}
this.nameInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.NameText,
inputType: 'text',
@@ -164,17 +178,11 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.name
});
const nameContainer = this.createLabelInputContainer(localizedConstants.NameText, this.nameInput);
this.hardwareGenerationInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.HardwareGenerationText,
inputType: 'text',
enabled: this.options.isNewObject,
value: this.objectInfo.hardwareGeneration.toString()
});
const hardwareGenerationContainer = this.createLabelInputContainer(localizedConstants.HardwareGenerationText, this.hardwareGenerationInput);
platformItems.push(nameContainer);
this.languageDropdown = this.createDropdown(localizedConstants.LanguageText, async () => { }, [this.objectInfo.language], this.objectInfo.language, this.options.isNewObject);
const languageContainer = this.createLabelInputContainer(localizedConstants.LanguageText, this.languageDropdown);
platformItems.push(languageContainer);
this.memoryInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.MemoryText,
@@ -183,6 +191,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: localizedConstants.StringValueInMB(this.objectInfo.memoryInMB.toString())
});
const memoryContainer = this.createLabelInputContainer(localizedConstants.MemoryText, this.memoryInput);
platformItems.push(memoryContainer);
this.operatingSystemInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.OperatingSystemText,
@@ -191,6 +200,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.operatingSystem
});
const operatingSystemContainer = this.createLabelInputContainer(localizedConstants.OperatingSystemText, this.operatingSystemInput);
platformItems.push(operatingSystemContainer);
this.platformInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.PlatformText,
@@ -199,6 +209,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.platform
});
const platformContainer = this.createLabelInputContainer(localizedConstants.PlatformText, this.platformInput);
platformItems.push(platformContainer);
this.processorsInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.ProcessorsText,
@@ -207,7 +218,10 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.processors
});
const processorsContainer = this.createLabelInputContainer(localizedConstants.ProcessorsText, this.processorsInput);
platformItems.push(processorsContainer);
// Information about the SQL instance itself
let sqlServerItems: azdata.Component[] = [];
this.isClusteredInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.IsClusteredText,
inputType: 'text',
@@ -215,6 +229,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.isClustered.toString()
});
const isClusteredContainer = this.createLabelInputContainer(localizedConstants.IsClusteredText, this.isClusteredInput);
sqlServerItems.push(isClusteredContainer);
this.isHadrEnabledInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.IsHadrEnabledText,
@@ -223,22 +238,29 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.isHadrEnabled.toString()
});
const isHadrEnabledContainer = this.createLabelInputContainer(localizedConstants.IsHadrEnabledText, this.isHadrEnabledInput);
sqlServerItems.push(isHadrEnabledContainer);
this.isPolyBaseInstalledInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.IsPolyBaseInstalledText,
inputType: 'text',
enabled: this.options.isNewObject,
value: this.objectInfo.isPolyBaseInstalled.toString()
});
const isPolyBaseInstalledContainer = this.createLabelInputContainer(localizedConstants.IsPolyBaseInstalledText, this.isPolyBaseInstalledInput);
if (!isUndefinedOrNull(this.objectInfo.isPolyBaseInstalled)) {
this.isPolyBaseInstalledInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.IsPolyBaseInstalledText,
inputType: 'text',
enabled: this.options.isNewObject,
value: this.objectInfo.isPolyBaseInstalled.toString()
});
const isPolyBaseInstalledContainer = this.createLabelInputContainer(localizedConstants.IsPolyBaseInstalledText, this.isPolyBaseInstalledInput);
sqlServerItems.push(isPolyBaseInstalledContainer);
}
this.isXTPSupportedInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.IsXTPSupportedText,
inputType: 'text',
enabled: this.options.isNewObject,
value: this.objectInfo.isXTPSupported.toString()
});
const isXTPSupportedContainer = this.createLabelInputContainer(localizedConstants.IsXTPSupportedText, this.isXTPSupportedInput);
if (!isUndefinedOrNull(this.objectInfo.isXTPSupported)) {
this.isXTPSupportedInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.IsXTPSupportedText,
inputType: 'text',
enabled: this.options.isNewObject,
value: this.objectInfo.isXTPSupported.toString()
});
const isXTPSupportedContainer = this.createLabelInputContainer(localizedConstants.IsXTPSupportedText, this.isXTPSupportedInput);
sqlServerItems.push(isXTPSupportedContainer);
}
this.productInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.ProductText,
@@ -247,14 +269,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.product
});
const productContainer = this.createLabelInputContainer(localizedConstants.ProductText, this.productInput);
this.reservedStorageSizeInMBInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.ReservedStorageSizeInMBText,
inputType: 'text',
enabled: this.options.isNewObject,
value: localizedConstants.StringValueInMB(this.objectInfo.reservedStorageSizeMB.toString())
});
const reservedStorageSizeInMBContainer = this.createLabelInputContainer(localizedConstants.ReservedStorageSizeInMBText, this.reservedStorageSizeInMBInput);
sqlServerItems.push(productContainer);
this.rootDirectoryInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.RootDirectoryText,
@@ -263,6 +278,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.rootDirectory
});
const rootDirectoryContainer = this.createLabelInputContainer(localizedConstants.RootDirectoryText, this.rootDirectoryInput);
sqlServerItems.push(rootDirectoryContainer);
this.serverCollationInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.ServerCollationText,
@@ -271,22 +287,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.serverCollation
});
const serverCollationContainer = this.createLabelInputContainer(localizedConstants.ServerCollationText, this.serverCollationInput);
this.serviceTierInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.ServiceTierText,
inputType: 'text',
enabled: this.options.isNewObject,
value: this.objectInfo.serviceTier
});
const serviceTierContainer = this.createLabelInputContainer(localizedConstants.ServiceTierText, this.serviceTierInput);
this.storageSpaceUsageInMBInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.StorageSpaceUsageInMBText,
inputType: 'text',
enabled: this.options.isNewObject,
value: localizedConstants.StringValueInMB(this.objectInfo.storageSpaceUsageInMB.toString())
});
const storageSpaceUsageInMbContainer = this.createLabelInputContainer(localizedConstants.StorageSpaceUsageInMBText, this.storageSpaceUsageInMBInput);
sqlServerItems.push(serverCollationContainer);
this.versionInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.VersionText,
@@ -295,32 +296,39 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
value: this.objectInfo.version
});
const versionContainer = this.createLabelInputContainer(localizedConstants.VersionText, this.versionInput);
sqlServerItems.push(versionContainer);
let platformItems = [
nameContainer,
languageContainer,
memoryContainer,
operatingSystemContainer,
platformContainer,
processorsContainer
];
if (!isUndefinedOrNull(this.objectInfo.reservedStorageSizeMB)) {
this.reservedStorageSizeInMBInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.ReservedStorageSizeInMBText,
inputType: 'text',
enabled: this.options.isNewObject,
value: localizedConstants.StringValueInMB(this.objectInfo.reservedStorageSizeMB.toString())
});
const reservedStorageSizeInMBContainer = this.createLabelInputContainer(localizedConstants.ReservedStorageSizeInMBText, this.reservedStorageSizeInMBInput);
sqlServerItems.push(reservedStorageSizeInMBContainer);
}
let sqlServerItems = [
isClusteredContainer,
isHadrEnabledContainer,
isPolyBaseInstalledContainer,
isXTPSupportedContainer,
productContainer,
rootDirectoryContainer,
serverCollationContainer,
versionContainer
];
if (this.objectInfo.serviceTier) {
this.serviceTierInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.ServiceTierText,
inputType: 'text',
enabled: this.options.isNewObject,
value: this.objectInfo.serviceTier
});
const serviceTierContainer = this.createLabelInputContainer(localizedConstants.ServiceTierText, this.serviceTierInput);
sqlServerItems.push(serviceTierContainer);
}
if (this.engineEdition === azdata.DatabaseEngineEdition.SqlManagedInstance) {
platformItems.unshift(hardwareGenerationContainer);
sqlServerItems.push(reservedStorageSizeInMBContainer, serviceTierContainer, storageSpaceUsageInMbContainer);
// remove isXTPSupported
sqlServerItems.splice(3, 1);
if (!isUndefinedOrNull(this.objectInfo.storageSpaceUsageInMB)) {
this.storageSpaceUsageInMBInput = this.createInputBox(async () => { }, {
ariaLabel: localizedConstants.StorageSpaceUsageInMBText,
inputType: 'text',
enabled: this.options.isNewObject,
value: localizedConstants.StringValueInMB(this.objectInfo.storageSpaceUsageInMB.toString())
});
const storageSpaceUsageInMbContainer = this.createLabelInputContainer(localizedConstants.StorageSpaceUsageInMBText, this.storageSpaceUsageInMBInput);
sqlServerItems.push(storageSpaceUsageInMbContainer);
}
this.platformSection = this.createGroup('Platform', platformItems, true);

View File

@@ -838,3 +838,9 @@ export async function ensureFileExists(absoluteFilePath: string, contents?: stri
}
}
}
export function throwIfFailed(result: azdataType.ResultStatus | vscodeMssql.ResultStatus): void {
if (!result.success) {
throw new Error(constants.errorPrefix(result.errorMessage));
}
}

View File

@@ -183,7 +183,9 @@ export class ProjectsController {
throw new Error(constants.invalidTargetPlatform(creationParams.targetPlatform, Array.from(constants.targetPlatformToVersion.keys())));
}
const targetPlatform = creationParams.targetPlatform ? constants.targetPlatformToVersion.get(creationParams.targetPlatform)! : constants.defaultDSP;
let targetPlatform = creationParams.targetPlatform ? constants.targetPlatformToVersion.get(creationParams.targetPlatform)! : constants.defaultDSP;
targetPlatform = constants.MicrosoftDatatoolsSchemaSqlSql + targetPlatform + constants.databaseSchemaProvider;
let newProjFileName = creationParams.newProjName;
@@ -197,15 +199,19 @@ export class ProjectsController {
throw new Error(constants.projectAlreadyExists(newProjFileName, path.parse(newProjFilePath).dir));
}
let result: azdataType.ResultStatus | mssqlVscode.ResultStatus;
const sqlProjectsService = await utils.getSqlProjectsService();
if (utils.getAzdataApi()) {
const projectStyle = creationParams.sdkStyle ? mssql.ProjectType.SdkStyle : mssql.ProjectType.LegacyStyle;
await (sqlProjectsService as mssql.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform);
result = await (sqlProjectsService as mssql.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform);
} else {
const projectStyle = creationParams.sdkStyle ? mssqlVscode.ProjectType.SdkStyle : mssqlVscode.ProjectType.LegacyStyle;
await (sqlProjectsService as mssqlVscode.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform);
result = await (sqlProjectsService as mssqlVscode.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform);
}
utils.throwIfFailed(result);
await this.addTemplateFiles(newProjFilePath, creationParams.projectTypeId);
return newProjFilePath;

View File

@@ -248,7 +248,7 @@ export class Project implements ISqlProject {
}
const result = await sqlProjService.getProjectProperties(this.projectFilePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
this._projectGuid = result.projectGuid;
@@ -274,7 +274,7 @@ export class Project implements ISqlProject {
private async readCrossPlatformCompatibility(): Promise<void> {
const result = await this.sqlProjService.getCrossPlatformCompatibility(this.projectFilePath)
this.throwIfFailed(result);
utils.throwIfFailed(result);
this._isCrossPlatformCompatible = result.isCrossPlatformCompatible;
}
@@ -302,7 +302,7 @@ export class Project implements ISqlProject {
var result: GetScriptsResult = await this.sqlProjService.getSqlObjectScripts(this.projectFilePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
if (result.scripts?.length > 0) { // empty array from SqlToolsService is deserialized as null
for (var script of result.scripts) {
@@ -326,7 +326,7 @@ export class Project implements ISqlProject {
private async readFolders(): Promise<void> {
var result: GetFoldersResult = await this.sqlProjService.getFolders(this.projectFilePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
const folderEntries: FileProjectEntry[] = [];
@@ -349,7 +349,7 @@ export class Project implements ISqlProject {
private async readPreDeployScripts(warnIfMultiple: boolean = false): Promise<void> {
var result: GetScriptsResult = await this.sqlProjService.getPreDeploymentScripts(this.projectFilePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
const preDeploymentScriptEntries: FileProjectEntry[] = [];
@@ -368,7 +368,7 @@ export class Project implements ISqlProject {
private async readPostDeployScripts(warnIfMultiple: boolean = false): Promise<void> {
var result: GetScriptsResult = await this.sqlProjService.getPostDeploymentScripts(this.projectFilePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
const postDeploymentScriptEntries: FileProjectEntry[] = [];
@@ -394,7 +394,7 @@ export class Project implements ISqlProject {
}
var result: GetScriptsResult = await sqlProjService.getNoneItems(this.projectFilePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
const noneItemEntries: FileProjectEntry[] = [];
@@ -510,7 +510,7 @@ export class Project implements ISqlProject {
}
const result = await this.sqlProjService.updateProjectForCrossPlatform(this.projectFilePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readCrossPlatformCompatibility();
}
@@ -529,7 +529,7 @@ export class Project implements ISqlProject {
}
const result = await this.sqlProjService.addFolder(this.projectFilePath, relativeFolderPath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
// Note: adding a folder does not mean adding the contents of the folder.
// SDK projects may still need to adjust their include/exclude globs, and Legacy projects must still include each file
@@ -539,7 +539,7 @@ export class Project implements ISqlProject {
public async deleteFolder(relativeFolderPath: string): Promise<void> {
const result = await this.sqlProjService.deleteFolder(this.projectFilePath, relativeFolderPath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readSqlObjectScripts();
await this.readPreDeployScripts();
@@ -550,7 +550,7 @@ export class Project implements ISqlProject {
public async excludeFolder(relativeFolderPath: string): Promise<void> {
const result = await this.sqlProjService.excludeFolder(this.projectFilePath, relativeFolderPath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readSqlObjectScripts();
await this.readPreDeployScripts();
@@ -561,7 +561,7 @@ export class Project implements ISqlProject {
public async moveFolder(relativeSourcePath: string, relativeDestinationPath: string): Promise<void> {
const result = await this.sqlProjService.moveFolder(this.projectFilePath, relativeSourcePath, relativeDestinationPath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readSqlObjectScripts();
await this.readPreDeployScripts();
@@ -576,7 +576,7 @@ export class Project implements ISqlProject {
public async addSqlObjectScript(relativePath: string, reloadAfter: boolean = true): Promise<void> {
const result = await this.sqlProjService.addSqlObjectScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
if (reloadAfter) {
await this.readSqlObjectScripts();
@@ -595,7 +595,7 @@ export class Project implements ISqlProject {
public async deleteSqlObjectScript(relativePath: string): Promise<void> {
const result = await this.sqlProjService.deleteSqlObjectScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readSqlObjectScripts();
await this.readFolders();
@@ -603,7 +603,7 @@ export class Project implements ISqlProject {
public async excludeSqlObjectScript(relativePath: string): Promise<void> {
const result = await this.sqlProjService.excludeSqlObjectScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readSqlObjectScripts();
await this.readFolders();
@@ -619,7 +619,7 @@ export class Project implements ISqlProject {
}
const result = await this.sqlProjService.addPreDeploymentScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readPreDeployScripts();
await this.readNoneItems();
@@ -628,7 +628,7 @@ export class Project implements ISqlProject {
public async deletePreDeploymentScript(relativePath: string): Promise<void> {
const result = await this.sqlProjService.deletePreDeploymentScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readPreDeployScripts();
await this.readFolders();
@@ -636,7 +636,7 @@ export class Project implements ISqlProject {
public async excludePreDeploymentScript(relativePath: string): Promise<void> {
const result = await this.sqlProjService.excludePreDeploymentScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readPreDeployScripts();
await this.readFolders();
@@ -652,7 +652,7 @@ export class Project implements ISqlProject {
}
const result = await this.sqlProjService.addPostDeploymentScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readPostDeployScripts();
await this.readNoneItems();
@@ -661,7 +661,7 @@ export class Project implements ISqlProject {
public async deletePostDeploymentScript(relativePath: string): Promise<void> {
const result = await this.sqlProjService.deletePostDeploymentScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readPostDeployScripts();
await this.readFolders();
@@ -669,7 +669,7 @@ export class Project implements ISqlProject {
public async excludePostDeploymentScript(relativePath: string): Promise<void> {
const result = await this.sqlProjService.excludePostDeploymentScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readPostDeployScripts();
await this.readFolders();
@@ -681,7 +681,7 @@ export class Project implements ISqlProject {
public async addNoneItem(relativePath: string): Promise<void> {
const result = await this.sqlProjService.addNoneItem(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readNoneItems();
await this.readFolders();
@@ -689,7 +689,7 @@ export class Project implements ISqlProject {
public async deleteNoneItem(relativePath: string): Promise<void> {
const result = await this.sqlProjService.deleteNoneItem(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readNoneItems();
await this.readFolders();
@@ -697,7 +697,7 @@ export class Project implements ISqlProject {
public async excludeNoneItem(relativePath: string): Promise<void> {
const result = await this.sqlProjService.excludeNoneItem(this.projectFilePath, relativePath);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readNoneItems();
await this.readFolders();
@@ -764,7 +764,7 @@ export class Project implements ISqlProject {
await this.readNoneItems();
}
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readFolders();
return this.createFileProjectEntry(normalizedRelativeFilePath, EntryType.File);
@@ -788,7 +788,7 @@ export class Project implements ISqlProject {
this._databaseSchemaProvider = `${constants.MicrosoftDatatoolsSchemaSqlSql}${compatLevel}${constants.databaseSchemaProvider}`;
const result = await this.sqlProjService.setDatabaseSchemaProvider(this.projectFilePath, this._databaseSchemaProvider);
this.throwIfFailed(result);
utils.throwIfFailed(result);
}
/**
@@ -921,7 +921,7 @@ export class Project implements ISqlProject {
public async deleteDatabaseReference(name: string): Promise<void> {
const result = await this.sqlProjService.deleteDatabaseReference(this.projectFilePath, name);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readDatabaseReferences();
}
@@ -936,7 +936,7 @@ export class Project implements ISqlProject {
*/
public async addSqlCmdVariable(name: string, defaultValue: string): Promise<void> {
const result = await this.sqlProjService.addSqlCmdVariable(this.projectFilePath, name, defaultValue);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readSqlCmdVariables();
}
@@ -947,13 +947,13 @@ export class Project implements ISqlProject {
*/
public async updateSqlCmdVariable(name: string, defaultValue: string): Promise<void> {
const result = await this.sqlProjService.updateSqlCmdVariable(this.projectFilePath, name, defaultValue);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readSqlCmdVariables();
}
public async deleteSqlCmdVariable(variableName: string): Promise<void> {
const result = await this.sqlProjService.deleteSqlCmdVariable(this.projectFilePath, variableName);
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readSqlCmdVariables();
}
@@ -979,7 +979,7 @@ export class Project implements ISqlProject {
sources.push(databaseSource);
const result = await this.sqlProjService.setDatabaseSource(this.projectFilePath, sources.join(';'));
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readProjectProperties();
}
@@ -1005,7 +1005,7 @@ export class Project implements ISqlProject {
sources.splice(index, 1);
const result = await this.sqlProjService.setDatabaseSource(this.projectFilePath, sources.join(';'));
this.throwIfFailed(result);
utils.throwIfFailed(result);
await this.readProjectProperties();
}
@@ -1029,12 +1029,6 @@ export class Project implements ISqlProject {
containsCreateTableStatement);
}
private throwIfFailed(result: ResultStatus): void {
if (!result.success) {
throw new Error(constants.errorPrefix(result.errorMessage));
}
}
/**
* Moves a file to a different location
* @param node Node being moved

View File

@@ -1016,7 +1016,7 @@ describe('Project: properties', function (): void {
throw new Error('Should not have succeeded.');
} catch (e) {
(e.message).should.startWith('Error: Invalid value for Database Schema Provider:');
(e.message).should.endWith('expected to be in the form Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider');
(e.message).should.endWith('expected to be in the form \'Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider\'.');
}
});