From 10b4c5051c0a061e8df903e554dedc238c75db09 Mon Sep 17 00:00:00 2001 From: Steffen Date: Tue, 5 Sep 2023 17:42:01 +0200 Subject: [PATCH 1/3] added StatementTimeout --- CHANGELOG.md | 6 ++++++ src/PsSmo/ConnectInstanceCommand.cs | 17 +++++++++++++++-- src/PsSmo/PsSmo.psd1 | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dca833b..b78e018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.2.1] - 2023-09-05 + +### Added + +- Added StatementTimeout to `Connect-Instance` command. + ## [1.2.0] - 2023-08-24 ### Changed diff --git a/src/PsSmo/ConnectInstanceCommand.cs b/src/PsSmo/ConnectInstanceCommand.cs index 31fa0bf..babcc56 100644 --- a/src/PsSmo/ConnectInstanceCommand.cs +++ b/src/PsSmo/ConnectInstanceCommand.cs @@ -97,6 +97,8 @@ public class ConnectInstanceCommand : PSCmdlet [ValidateNotNullOrEmpty()] public SecureString Password { get; set; } + [Parameter()] + public int StatementTimeout { get; set; } = 600; #endregion protected override void ProcessRecord() @@ -111,6 +113,9 @@ protected override void ProcessRecord() serverConnection: new ServerConnection( sqlConnection: Connection ) + { + StatementTimeout = StatementTimeout + } ); break; @@ -124,6 +129,9 @@ protected override void ProcessRecord() serverConnection: new ServerConnection( sqlConnection: Connection ) + { + StatementTimeout = StatementTimeout + } ); break; } @@ -138,8 +146,7 @@ protected override void ProcessRecord() if (DataSource.EndsWith("database.windows.net")) { Connection = new SqlConnection(connectionString: builder.ConnectionString); - if (AccessToken == null) - AccessToken = new AzureServiceTokenProvider().GetAccessTokenAsync("https://database.windows.net").Result; + AccessToken ??= new AzureServiceTokenProvider().GetAccessTokenAsync("https://database.windows.net").Result; Connection.AccessToken = AccessToken; } else @@ -151,6 +158,9 @@ protected override void ProcessRecord() serverConnection: new ServerConnection( sqlConnection: Connection ) + { + StatementTimeout = StatementTimeout + } ); break; } @@ -171,6 +181,9 @@ protected override void ProcessRecord() serverConnection: new ServerConnection( sqlConnection: Connection ) + { + StatementTimeout = StatementTimeout + } ); break; } diff --git a/src/PsSmo/PsSmo.psd1 b/src/PsSmo/PsSmo.psd1 index 72ff742..0ca1ff2 100644 --- a/src/PsSmo/PsSmo.psd1 +++ b/src/PsSmo/PsSmo.psd1 @@ -12,7 +12,7 @@ RootModule = 'PsSmo.dll' # Version number of this module. -ModuleVersion = '1.2.0' +ModuleVersion = '1.2.1' # Supported PSEditions # CompatiblePSEditions = @() From 8208aec66f5533f4ae94585b542988bf25f88d8c Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 6 Sep 2023 08:27:33 +0200 Subject: [PATCH 2/3] added hotfix prerelease trigger --- .github/workflows/pre-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 0b1fc58..13c0f2c 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,6 +1,6 @@ on: push: - branches: [ release/* ] + branches: [ release/*, hotfix/* ] workflow_dispatch: jobs: From c2cc455c7cd955f8b4d5289896a042b91a7096c2 Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 6 Sep 2023 13:03:01 +0200 Subject: [PATCH 3/3] added docs --- docs/Connect-SmoInstance.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/Connect-SmoInstance.md b/docs/Connect-SmoInstance.md index 741ae6c..613d3b8 100644 --- a/docs/Connect-SmoInstance.md +++ b/docs/Connect-SmoInstance.md @@ -15,23 +15,23 @@ schema: 2.0.0 ### Properties_IntegratedSecurity (Default) ``` Connect-SmoInstance [-DataSource] [[-InitialCatalog] ] [-AccessToken ] - [] + [-StatementTimeout ] [] ``` ### SqlClient ``` -Connect-SmoInstance -Connection [] +Connect-SmoInstance -Connection [-StatementTimeout ] [] ``` ### ConnectionString ``` -Connect-SmoInstance [-ConnectionString] [] +Connect-SmoInstance [-ConnectionString] [-StatementTimeout ] [] ``` ### Properties_Credential ``` Connect-SmoInstance [-DataSource] [[-InitialCatalog] ] [-UserId] - [-Password] [] + [-Password] [-StatementTimeout ] [] ``` ## DESCRIPTION @@ -153,6 +153,21 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` +### -StatementTimeout +This is the number of seconds that a statement is attempted to be sent to the server before it fails. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).