Introduce 'Command timeout' connection property support (#17525)
This commit is contained in:
Родитель
cfe1dcdddd
Коммит
dd3c5096e1
|
@ -141,7 +141,10 @@
|
|||
<source xml:lang="en">[Optional] When set to false, security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mssql.connection.connectTimeout">
|
||||
<source xml:lang="en">[Optional] Specify the length of time in seconds to wait for a connection to the server before it times out. The default timeout value for Azure SQL Database is 30.</source>
|
||||
<source xml:lang="en">[Optional] Specify the length of time in seconds to wait for a connection to the server before terminating connection attempt and generating an error. The default value is 15 seconds for on-premise and 30 seconds for Azure SQL Database connections.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mssql.connection.commandTimeout">
|
||||
<source xml:lang="en">[Optional] Specify the length of time in seconds to wait for a command to execute before terminating the attempt and generating an error. The default value is 30 seconds.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mssql.connection.connectRetryCount">
|
||||
<source xml:lang="en">[Optional] Specify the number of attempts to restore connection.</source>
|
||||
|
|
|
@ -659,6 +659,11 @@
|
|||
"default": 15,
|
||||
"description": "%mssql.connection.connectTimeout%"
|
||||
},
|
||||
"commandTimeout": {
|
||||
"type": "number",
|
||||
"default": 30,
|
||||
"description": "%mssql.connection.commandTimeout%"
|
||||
},
|
||||
"connectRetryCount": {
|
||||
"type": "number",
|
||||
"default": 1,
|
||||
|
|
|
@ -45,7 +45,9 @@
|
|||
"mssql.connection.trustServerCertificate":"[Optional] When set to 'true', the SQL Server SSL certificate is automatically trusted when the communication layer is encrypted using SSL. Set 'false' for Azure SQL Database connection.",
|
||||
"mssql.connection.hostNameInCertificate":"[Optional] When specified (and encrypt=Mandatory and trustServerCertificate=false), SQL Server uses provided hostname for validating trust with the server certificate.",
|
||||
"mssql.connection.persistSecurityInfo":"[Optional] When set to false, security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state.",
|
||||
"mssql.connection.connectTimeout":"[Optional] Specify the length of time in seconds to wait for a connection to the server before it times out. The default timeout value for Azure SQL Database is 30.",
|
||||
"mssql.connection.connectTimeout":"[Optional] Specify the length of time in seconds to wait for a connection to the server before terminating connection attempt and generating an error. The default value is 15 seconds for on-premise and 30 seconds for Azure SQL Database connections.",
|
||||
|
||||
"mssql.connection.commandTimeout":"[Optional] Specify the length of time in seconds to wait for a command to execute before terminating the attempt and generating an error. The default value is 30 seconds.",
|
||||
"mssql.connection.connectRetryCount":"[Optional] Specify the number of attempts to restore connection.",
|
||||
"mssql.connection.connectRetryInterval":"[Optional] Specify the delay between attempts to restore connection.",
|
||||
"mssql.connection.workstationId":"[Optional] Specify the name of the workstation connecting to SQL Server.",
|
||||
|
|
|
@ -63,6 +63,7 @@ export const cmdAadRemoveAccount = 'mssql.removeAadAccount';
|
|||
export const sqlDbPrefix = '.database.windows.net';
|
||||
export const defaultConnectionTimeout = 15;
|
||||
export const azureSqlDbConnectionTimeout = 30;
|
||||
export const defaultCommandTimeout = 30;
|
||||
export const azureDatabase = 'Azure';
|
||||
export const azureMfa = 'AzureMFA';
|
||||
export const defaultPortNumber = 1433;
|
||||
|
|
|
@ -29,6 +29,7 @@ export class ConnectionCredentials implements IConnectionInfo {
|
|||
public hostNameInCertificate: string | undefined;
|
||||
public persistSecurityInfo: boolean | undefined;
|
||||
public connectTimeout: number | undefined;
|
||||
public commandTimeout: number | undefined;
|
||||
public connectRetryCount: number | undefined;
|
||||
public connectRetryInterval: number | undefined;
|
||||
public applicationName: string | undefined;
|
||||
|
@ -74,6 +75,7 @@ export class ConnectionCredentials implements IConnectionInfo {
|
|||
details.options['hostNameInCertificate'] = credentials.hostNameInCertificate;
|
||||
details.options['persistSecurityInfo'] = credentials.persistSecurityInfo;
|
||||
details.options['connectTimeout'] = credentials.connectTimeout;
|
||||
details.options['commandTimeout'] = credentials.commandTimeout;
|
||||
details.options['connectRetryCount'] = credentials.connectRetryCount;
|
||||
details.options['connectRetryInterval'] = credentials.connectRetryInterval;
|
||||
details.options['applicationName'] = credentials.applicationName;
|
||||
|
|
|
@ -39,6 +39,10 @@ export function fixupConnectionCredentials(connCreds: IConnectionInfo): IConnect
|
|||
connCreds.connectTimeout = Constants.defaultConnectionTimeout;
|
||||
}
|
||||
|
||||
if (!connCreds.commandTimeout) {
|
||||
connCreds.commandTimeout = Constants.defaultCommandTimeout;
|
||||
}
|
||||
|
||||
// default value for encrypt
|
||||
if (connCreds.encrypt === '' || connCreds.encrypt === true) {
|
||||
connCreds.encrypt = EncryptOptions.Mandatory;
|
||||
|
|
|
@ -38,6 +38,7 @@ function createTestCredentials(): IConnectionInfo {
|
|||
hostNameInCertificate: '',
|
||||
persistSecurityInfo: false,
|
||||
connectTimeout: 15,
|
||||
commandTimeout: 30,
|
||||
connectRetryCount: 0,
|
||||
connectRetryInterval: 0,
|
||||
applicationName: 'vscode-mssql',
|
||||
|
@ -201,6 +202,7 @@ suite('Connection Profile tests', () => {
|
|||
assert.notStrictEqual(typeof details.options['connectRetryCount'], 'undefined');
|
||||
assert.notStrictEqual(typeof details.options['connectRetryInterval'], 'undefined');
|
||||
assert.notStrictEqual(typeof details.options['connectTimeout'], 'undefined');
|
||||
assert.notStrictEqual(typeof details.options['commandTimeout'], 'undefined');
|
||||
assert.notStrictEqual(typeof details.options['currentLanguage'], 'undefined');
|
||||
assert.notStrictEqual(typeof details.options['database'], 'undefined');
|
||||
assert.notStrictEqual(typeof details.options['encrypt'], 'undefined');
|
||||
|
|
|
@ -60,6 +60,7 @@ function createTestCredentials(): IConnectionInfo {
|
|||
hostNameInCertificate: '',
|
||||
persistSecurityInfo: false,
|
||||
connectTimeout: 15,
|
||||
commandTimeout: 30,
|
||||
connectRetryCount: 0,
|
||||
connectRetryInterval: 0,
|
||||
applicationName: 'vscode-mssql',
|
||||
|
|
|
@ -311,6 +311,11 @@ declare module 'vscode-mssql' {
|
|||
*/
|
||||
connectTimeout: number | undefined;
|
||||
|
||||
/**
|
||||
* Gets or sets the length of time (in seconds) to wait for a command to execute before terminating the attempt and generating an error.
|
||||
*/
|
||||
commandTimeout: number | undefined;
|
||||
|
||||
/**
|
||||
* The number of reconnections attempted after identifying that there was an idle connection failure.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче