mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 02:48:30 -05:00
Support advanced options in command line arguments (#23104)
This commit is contained in:
@@ -97,10 +97,24 @@ export class TestCapabilitiesService implements ICapabilitiesService {
|
||||
valueType: ServiceOptionType.string
|
||||
}
|
||||
];
|
||||
let mssqlAdvancedOptions: azdata.ConnectionOption[] = [
|
||||
{
|
||||
name: 'trustServerCertificate',
|
||||
displayName: undefined!,
|
||||
description: undefined!,
|
||||
groupName: undefined!,
|
||||
categoryValues: undefined!,
|
||||
defaultValue: 'false',
|
||||
isIdentity: false,
|
||||
isRequired: false,
|
||||
specialValueType: undefined!,
|
||||
valueType: ServiceOptionType.boolean
|
||||
}
|
||||
];
|
||||
let msSQLCapabilities = {
|
||||
providerId: mssqlProviderName,
|
||||
displayName: 'MSSQL',
|
||||
connectionOptions: connectionProvider,
|
||||
connectionOptions: connectionProvider.concat(mssqlAdvancedOptions),
|
||||
};
|
||||
let pgSQLCapabilities = {
|
||||
providerId: this.pgsqlProviderName,
|
||||
|
||||
@@ -202,6 +202,27 @@ export class ProviderConnectionInfo implements azdata.ConnectionInfo {
|
||||
* Example: "providerName:MSSQL|authenticationType:|databaseName:database|serverName:server3|userName:user|group:testid"
|
||||
*/
|
||||
public getOptionsKey(): string {
|
||||
let idNames = this.getOptionKeyIdNames();
|
||||
idNames = idNames.filter(x => x !== undefined);
|
||||
|
||||
//Sort to make sure using names in the same order every time otherwise the ids would be different
|
||||
idNames.sort();
|
||||
|
||||
let idValues: string[] = [];
|
||||
for (let index = 0; index < idNames.length; index++) {
|
||||
let value = this.options[idNames[index]!];
|
||||
value = value ? value : '';
|
||||
idValues.push(`${idNames[index]}${ProviderConnectionInfo.nameValueSeparator}${value}`);
|
||||
}
|
||||
|
||||
return ProviderConnectionInfo.ProviderPropertyName + ProviderConnectionInfo.nameValueSeparator +
|
||||
this.providerName + ProviderConnectionInfo.idSeparator + idValues.join(ProviderConnectionInfo.idSeparator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns Array of option key names
|
||||
*/
|
||||
public getOptionKeyIdNames(): string[] {
|
||||
let idNames = [];
|
||||
if (this.serverCapabilities) {
|
||||
idNames = this.serverCapabilities.connectionOptions.map(o => {
|
||||
@@ -217,21 +238,7 @@ export class ProviderConnectionInfo implements azdata.ConnectionInfo {
|
||||
// This should never happen but just incase the serverCapabilities was not ready at this time
|
||||
idNames = ['authenticationType', 'database', 'server', 'user'];
|
||||
}
|
||||
|
||||
idNames = idNames.filter(x => x !== undefined);
|
||||
|
||||
//Sort to make sure using names in the same order every time otherwise the ids would be different
|
||||
idNames.sort();
|
||||
|
||||
let idValues: string[] = [];
|
||||
for (let index = 0; index < idNames.length; index++) {
|
||||
let value = this.options[idNames[index]!];
|
||||
value = value ? value : '';
|
||||
idValues.push(`${idNames[index]}${ProviderConnectionInfo.nameValueSeparator}${value}`);
|
||||
}
|
||||
|
||||
return ProviderConnectionInfo.ProviderPropertyName + ProviderConnectionInfo.nameValueSeparator +
|
||||
this.providerName + ProviderConnectionInfo.idSeparator + idValues.join(ProviderConnectionInfo.idSeparator);
|
||||
return idNames;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user