Skip to content

Commit

Permalink
Merge branch 'hotfix/1.2.1' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen committed Sep 7, 2023
2 parents 40eccbc + c2cc455 commit c7fc9fb
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [ release/* ]
branches: [ release/*, hotfix/* ]
workflow_dispatch:

jobs:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated System.Management.Automation to 7.2.13.
- Updated Microsoft.Data.SqlClient to 5.1.1.

## [1.2.1] - 2023-09-05

### Added

- Added StatementTimeout to `Connect-Instance` command.

## [1.2.0] - 2023-08-24

### Changed
Expand Down
23 changes: 19 additions & 4 deletions docs/Connect-SmoInstance.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ schema: 2.0.0
### Properties_IntegratedSecurity (Default)
```
Connect-SmoInstance [-DataSource] <String> [[-InitialCatalog] <String>] [-AccessToken <String>]
[<CommonParameters>]
[-StatementTimeout <Int32>] [<CommonParameters>]
```

### SqlClient
```
Connect-SmoInstance -Connection <SqlConnection> [<CommonParameters>]
Connect-SmoInstance -Connection <SqlConnection> [-StatementTimeout <Int32>] [<CommonParameters>]
```

### ConnectionString
```
Connect-SmoInstance [-ConnectionString] <String> [<CommonParameters>]
Connect-SmoInstance [-ConnectionString] <String> [-StatementTimeout <Int32>] [<CommonParameters>]
```

### Properties_Credential
```
Connect-SmoInstance [-DataSource] <String> [[-InitialCatalog] <String>] [-UserId] <String>
[-Password] <SecureString> [<CommonParameters>]
[-Password] <SecureString> [-StatementTimeout <Int32>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -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).
Expand Down
17 changes: 15 additions & 2 deletions src/PsSmo/ConnectInstanceCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -111,6 +113,9 @@ protected override void ProcessRecord()
serverConnection: new ServerConnection(
sqlConnection: Connection
)
{
StatementTimeout = StatementTimeout
}
);
break;

Expand All @@ -124,6 +129,9 @@ protected override void ProcessRecord()
serverConnection: new ServerConnection(
sqlConnection: Connection
)
{
StatementTimeout = StatementTimeout
}
);
break;
}
Expand All @@ -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
Expand All @@ -151,6 +158,9 @@ protected override void ProcessRecord()
serverConnection: new ServerConnection(
sqlConnection: Connection
)
{
StatementTimeout = StatementTimeout
}
);
break;
}
Expand All @@ -171,6 +181,9 @@ protected override void ProcessRecord()
serverConnection: new ServerConnection(
sqlConnection: Connection
)
{
StatementTimeout = StatementTimeout
}
);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/PsSmo/PsSmo.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PsSmo.dll'

# Version number of this module.
ModuleVersion = '1.2.0'
ModuleVersion = '1.2.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down

0 comments on commit c7fc9fb

Please sign in to comment.