Skip to content

Commit

Permalink
Adding support for pagination in Sql Get Databases (#15772)
Browse files Browse the repository at this point in the history
* add support for pagination in sql get databases

* Update ChangeLog.md

* Update ChangeLog.md

Co-authored-by: Yabo Hu <[email protected]>
  • Loading branch information
harpaul-gill and VeryEarly authored Aug 30, 2021
1 parent e8eabf2 commit 6f3647d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Sql/Sql/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
- Additional information about change #1
-->
## Upcoming Release
* Changed the underlying implementation of `Get-AzSqlDatabase` to support a paginated response from the server
* Added `ZoneRedundant` parameter to `New-AzSqlInstance` and `Set-AzSqlInstance` to enable the creation and the update of zone - redundant instances.
* Added ZoneRedundant field to the model of the managed instance so that it displays information about zone - redundancy for instance that are returned by `Get-AzSqlInstance`.
* Extended AuditActionGroups enum in server & database audit. Added DBCC_GROUP, DATABASE_OWNERSHIP_CHANGE_GROUP and DATABASE_CHANGE_GROUP.
* Added `AsJob` flag to `Remove-AzSqlInstance`
* Added `SubnetId` parameter to `Set-AzSqlInstance` to support the cross-subnet update SLO
* Upgraded to newest SDK version


## Version 3.4.1
* Fixed identity logic in `Set-AzSqlServer` and `Set-AzSqlInstance`

Expand Down
13 changes: 12 additions & 1 deletion src/Sql/Sql/Database/Services/AzureSqlDatabaseCommunicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,18 @@ public Management.Sql.LegacySdk.Models.Database GetExpanded(string resourceGroup
/// </summary>
public IList<Management.Sql.Models.Database> List(string resourceGroupName, string serverName)
{
return new List<Management.Sql.Models.Database>(GetCurrentSqlClient().Databases.ListByServer(resourceGroupName, serverName));
List<Management.Sql.Models.Database> resultsList = new List<Management.Sql.Models.Database>();

var pagedResponse = GetCurrentSqlClient().Databases.ListByServer(resourceGroupName, serverName);
resultsList.AddRange(pagedResponse);

while (!string.IsNullOrEmpty(pagedResponse.NextPageLink))
{
pagedResponse = GetCurrentSqlClient().Databases.ListByServerNext(pagedResponse.NextPageLink);
resultsList.AddRange(pagedResponse);
}

return resultsList;
}

/// <summary>
Expand Down

0 comments on commit 6f3647d

Please sign in to comment.