mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 01:25:37 -05:00
Swapping Record usage to Map in SQL Projects (#22758)
* Changing SqlCmdVars from Record to Map * Converting the rest * Updating tests * more cleanup * Updating test to use new test creation API
This commit is contained in:
@@ -44,7 +44,7 @@ export class Project implements ISqlProject {
|
||||
private _folders: FileProjectEntry[] = [];
|
||||
private _dataSources: DataSource[] = [];
|
||||
private _databaseReferences: IDatabaseReferenceProjectEntry[] = [];
|
||||
private _sqlCmdVariables: Record<string, string> = {};
|
||||
private _sqlCmdVariables: Map<string, string> = new Map();
|
||||
private _preDeployScripts: FileProjectEntry[] = [];
|
||||
private _postDeployScripts: FileProjectEntry[] = [];
|
||||
private _noneDeployScripts: FileProjectEntry[] = [];
|
||||
@@ -97,7 +97,7 @@ export class Project implements ISqlProject {
|
||||
return this._databaseReferences;
|
||||
}
|
||||
|
||||
public get sqlCmdVariables(): Record<string, string> {
|
||||
public get sqlCmdVariables(): Map<string, string> {
|
||||
return this._sqlCmdVariables;
|
||||
}
|
||||
|
||||
@@ -267,10 +267,10 @@ export class Project implements ISqlProject {
|
||||
throw new Error(constants.errorReadingProject(constants.sqlCmdVariables, this.projectFilePath, sqlcmdVariablesResult.errorMessage));
|
||||
}
|
||||
|
||||
this._sqlCmdVariables = {};
|
||||
this._sqlCmdVariables = new Map();
|
||||
|
||||
for (const variable of sqlcmdVariablesResult.sqlCmdVariables) {
|
||||
this._sqlCmdVariables[variable.varName] = variable.defaultValue; // store the default value that's specified in the .sqlproj
|
||||
this._sqlCmdVariables.set(variable.varName, variable.defaultValue); // store the default value that's specified in the .sqlproj
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ export class Project implements ISqlProject {
|
||||
private resetProject(): void {
|
||||
this._files = [];
|
||||
this._databaseReferences = [];
|
||||
this._sqlCmdVariables = {};
|
||||
this._sqlCmdVariables = new Map();
|
||||
this._preDeployScripts = [];
|
||||
this._postDeployScripts = [];
|
||||
this._noneDeployScripts = [];
|
||||
@@ -843,7 +843,8 @@ export class Project implements ISqlProject {
|
||||
* @param defaultValue
|
||||
*/
|
||||
public async addSqlCmdVariable(name: string, defaultValue: string): Promise<void> {
|
||||
await this.sqlProjService.addSqlCmdVariable(this.projectFilePath, name, defaultValue);
|
||||
const result = await this.sqlProjService.addSqlCmdVariable(this.projectFilePath, name, defaultValue);
|
||||
this.throwIfFailed(result);
|
||||
await this.readSqlCmdVariables();
|
||||
}
|
||||
|
||||
@@ -853,7 +854,8 @@ export class Project implements ISqlProject {
|
||||
* @param defaultValue
|
||||
*/
|
||||
public async updateSqlCmdVariable(name: string, defaultValue: string): Promise<void> {
|
||||
await this.sqlProjService.updateSqlCmdVariable(this.projectFilePath, name, defaultValue);
|
||||
const result = await this.sqlProjService.updateSqlCmdVariable(this.projectFilePath, name, defaultValue);
|
||||
this.throwIfFailed(result);
|
||||
await this.readSqlCmdVariables();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user