Skip to content

Update to v161.47027.0 #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 75 additions & 9 deletions Nuget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@

# Introduction

This file will log substantial changes made to SMO between public releases to nuget.org.

## 161.47027.0

- Fix distribution columns on scripting for taking into consideration more than one distribution column
- Add new EXTGOV_OPERATION_GROUP audit action type
- Force [quoted identifier on](https://github.com/microsoft/sqlmanagementobjects/issues/96) for table scripts
- Fix EnumObjects sort by Schema
- Add new enumeration values for SQL Server 2022 permissions
- Script FIRST_ROW support for serverless Synapse

## 161.47021.0

- Add `LedgerViewSchema` property to table objects
Expand All @@ -24,10 +32,10 @@ This file will log substantial changes made to SMO between public releases to nu
- Add `LoginType` property to `ILoginOptions` interface.
- `Login.PasswordPolicyEnforced` now returns `false` for Windows logins instead of throwing an exception
- Remove net461 binaries from nuget packages
- Added Scripting Support for Ledger tables for SQL 2022+
- Added Scripting Support for Ledger tables for Sql 2022+
- Change the `Size` property on `Server/Drive` objects to `System.Int64`. These objects don't have a C# wrapper class so it's not breaking any compilation.
- Add support for SQL Server version 16
- Add new permissions for SQL 2019+ to SMO enumerations
- Add support for Sql Server version 16
- Add new permissions for Sql 2019+ to SMO enumerations
- Added External Stream object and External Streaming Jobs object for scripting
- Add support for XML compression

Expand All @@ -43,7 +51,7 @@ This file will log substantial changes made to SMO between public releases to nu
## 161.46437.65

- Update Microsoft.Data.SqlClient dependency to version 3.0.0
- Added Scripting Support for Ledger table in Azure SQLDB
- Added Scripting Support for Ledger table in Azure Sql db
- Change `Server.MasterDBPath` and `Server.MasterDBLogPath` properties to use `file_id` instead of `name` from `sys.database_files`
- Enable Index creation for memory optimized tables in Azure
- Fix Server/Logins to show external Logins for Azure SQLDB as they are now supported
Expand Down Expand Up @@ -122,7 +130,65 @@ This file will log substantial changes made to SMO between public releases to nu
- Enabled Server.EnumServerAttributes API on Azure SQL Database
- Enabled Lock enumeration APIs on Azure SQL Database
- Deleted the Database.CheckIdentityValues API
- Added new property "RequestMaximumMemoryGrantPercentageAsDouble" in WorkloadGroup to accept decimal values in Resource Governor (SQL 2019+).
- Changed the netfx binaries in Microsoft.SqlServer.SqlManagementObjects package to use Microsoft.Data.SqlClient
- Added a new package, Microsoft.SqlServer.SqlManagementObjects.SSMS, which only has netfx binaries and that uses System.Data.SqlClient

- Added new property "RequestMaximumMemoryGrantPercentageAsDouble" in WorkloadGroup to accept decimal values in Resource Governor (SQL2019 and above).
- Fixed a scripting issue with statistics on filtered indexes where the filter from the index would be scripted with the UPDATE STATISTICS TSQL.
- Enabled Security Policy and Security Predicate objects on Azure SQL DataWarehouse

## 160.2004021.0

- First non-preview 160 release, aligned with [SQL Server Management Studio](https://aka.ms/ssmsfullsetup) 18.5
- Script extended properties for Azure SQL Database objects
- Enable Jupyter Notebook output for SqlScriptPublishModel. SSMS 18.5 can output a Notebook for Azure Data Studio in Generate Scripts now.
- Fix issue where Table.EnableAllIndexes(Recreate) did nothing
- Fix Database.EnumObjectPermissions usage in NetStandard binaries
- Remove FORCE ORDER hint from table enumeration that was causing major performance issues
- Fix Transfer with PrefetchAllObjects == false for pre-Sql 2014 versions so it doesn't throw an exception
- Extend value range for platform, name, and engineEdition JSON properties of SQL Assessment targets with arrays of strings:

```JSON
"target": {
"platform": ["Windows", "Linux"],
"name": ["master", "temp"]
}
```

- Add 13 new [SQL Assessment rules](https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/sql-assessment-api/release-notes.md)
- Fix help link in XTPHashAvgChainBuckets SQL Assessment rule
- Units for threshold parameter of FullBackup SQL Assessment rule changed from hours to days

## 160.201141.0-preview

- Remove unneeded "using" TSQL statements from Database.CheckTables method implementations
- Enable ColumnMasterKey properties Signature and AllowEnclaveComputations for Azure SQL DB
- Fix Database.EncryptionEnabled and Database.DatabaseEncryptionKey behavior during Database.Alter(). Now, this code will correctly create a new key using the server certificate named MyCertificate:

```C#
db.EncryptionEnabled = true;
db.DatabaseEncryptionKey.EncryptorName = "MyCertificate";
db.DatabaseEncryptionKey.EncryptionAlgorithm = DatabaseEncryptionAlgorithm.Aes256;
db.DatabaseEncryptionKey.EncryptionType = DatabaseEncryptionType.ServerCertificate;
db.Alter()
```

- Fixed the "like" and "contains" URN filter functions to work with parameters containing single quotes. These operators can be used to optimally initialize collections:

```C#
// populate the collection with databases that have Name starting with "RDA"
var server = Server(new ServerConnection(sqlConnection));
server.Databases.ClearAndInitialize("[like(@Name, 'RDA%')]", new string[] { });
```

- Make Table.Location property optional for creating or scripting external tables.
- Enable scripting of ANSI_PADDING settings for Azure SQL Database tables.
- Remove obsolete types ServerActiveDirectory and DatabaseActiveDirectory
- Added BLOB_STORAGE scripting support for external data sources
- Fixed [error scripting external tables](https://feedback.azure.com/forums/908035-sql-server/suggestions/38267746-cannot-script-external-table-in-ssms-18-2) for Azure SQL Database
- Replace Microsoft.SqlServer.Management.SqlParser.dll with a dependency to its Nuget package

## 160.1911221.0-preview

- Increase major version from 15 to 16
- Remove dependency on native batch parser from NetFx components
- Change NetStandard client driver to Microsoft.Data.SqlClient
- Add distribution property for DW materialized views
- Script FILLFACTOR for indexes on Azure SQL Database
Binary file added docs/media/certsettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion init.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ doskey smoenum=pushd %BASEDIR%src\Microsoft\SqlServer\Management\SqlEnum\$*
doskey clean=powershell.exe -ExecutionPolicy Unrestricted -File "%BASEDIR%init.ps1" -Clean
doskey tst=pushd %BASEDIR%src\FunctionalTest\Smo\$*


REM == Common test command:
doskey rtests=pushd %BASEDIR%target\distrib\debug\net462$Tvstest.console.exe microsoft.sqlserver.test.smo.dll /logger:trx /TestCaseFilter:"(TestCategory != Staging)" /Settings:%BASEDIR%src\FunctionalTest\Framework\functionaltest.runsettings $*
doskey netcoretests=pushd %BASEDIR%target\distrib\debug\netcoreapp3.1$Tvstest.console.exe microsoft.sqlserver.test.smo.dll /logger:trx /TestCaseFilter:"(TestCategory != Staging)" /Settings:%BASEDIR%src\FunctionalTest\Framework\functionaltest.runsettings $*
Expand Down
1 change: 1 addition & 0 deletions src/Codegen/cfg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
<property name="AutoCreateIncrementalStatisticsEnabled" generate="true" is_intrinsic="false" />
<property name="AutoUpdateStatisticsEnabled" generate="true" is_intrinsic="false" />
<property name="AzureEdition" generate="true" is_intrinsic="false" />
<property name="RealEngineEdition" generate="false" is_intrinsic="false" />
<property name="AzureServiceObjective" generate="true" is_intrinsic="false" />
<property name="CaseSensitive" generate="true" is_intrinsic="false" />
<!-- Change Tracking Properties for the database-->
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
</PropertyGroup>
<PropertyGroup>
<!-- these variables are referenced by packagebuild.proj for inclusion in nuspecs and used by packages.props -->
<SqlParserPackageVersion>160.22504.0</SqlParserPackageVersion>
<SqlParserPackageVersion>160.22510.0</SqlParserPackageVersion>
<SqlClientPackage>Microsoft.Data.SqlClient</SqlClientPackage>
<SqlClientPackageVersion>3.1.0</SqlClientPackageVersion>
</PropertyGroup>
Expand Down
10 changes: 8 additions & 2 deletions src/FunctionalTest/Smo/Agent/JobServerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Data;
using System.Diagnostics;
using System.Linq;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Sdk.Sfc;
Expand All @@ -18,10 +17,10 @@
namespace Microsoft.SqlServer.Test.SMO.Agent
{
[TestClass]
[SupportedServerVersionRange(Edition = Management.Common.DatabaseEngineEdition.Enterprise)]
public class JobServerTests : SqlTestBase
{
[TestMethod]
[SupportedServerVersionRange(Edition = Management.Common.DatabaseEngineEdition.Enterprise)]
public void JobServer_PurgeJobHistory_generates_correct_query()
{
ExecuteTest(() =>
Expand Down Expand Up @@ -49,6 +48,7 @@ public void JobServer_PurgeJobHistory_generates_correct_query()

[TestMethod]
[UnsupportedHostPlatform(SqlHostPlatforms.Linux)]
[SupportedServerVersionRange(MinMajor = 16, Edition = DatabaseEngineEdition.Enterprise)]
public void JobServer_EnumPerformanceCounters_returns_agent_counters()
{
ExecuteTest(() =>
Expand All @@ -70,6 +70,7 @@ public void JobServer_EnumPerformanceCounters_returns_agent_counters()
}

[TestMethod]
[SupportedServerVersionRange(Edition = Management.Common.DatabaseEngineEdition.Enterprise)]
public void JobServer_Msx_methods_generate_correct_queries()
{
ExecuteTest(() =>
Expand All @@ -92,6 +93,8 @@ public void JobServer_Msx_methods_generate_correct_queries()
}

[TestMethod]
[SupportedServerVersionRange(Edition = Management.Common.DatabaseEngineEdition.Enterprise)]

public void JobServer_ErrorLog_methods_generate_correct_queries()
{
ExecuteTest(() =>
Expand Down Expand Up @@ -135,7 +138,9 @@ private Job CreateJob(string loginName = null)
job.Refresh();
return job;
}

[TestMethod]
[SupportedServerVersionRange(Edition = Management.Common.DatabaseEngineEdition.Enterprise)]
public void JobServer_Job_methods()
{
ExecuteTest(() =>
Expand Down Expand Up @@ -180,6 +185,7 @@ public void JobServer_Job_methods()
}

[TestMethod]
[SupportedServerVersionRange(Edition = Management.Common.DatabaseEngineEdition.Enterprise)]
public void JobServer_miscellaneous_methods_generate_correct_queries()
{
ExecuteTest(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public void ServerAuditspecifications_Audit_Action_Types_In_DB_Should_Match_Enum
UNION ALL SELECT name FROM (VALUES ('SELECT'),('UPDATE'),('INSERT'),('DELETE'),('EXECUTE'),('RECEIVE'),('REFERENCES')) actions(name)";

var dbAuditList = ServerContext.ConnectionContext.ExecuteWithResults(query).Tables[0].Rows.Cast<DataRow>().Select(row => row["name"].ToString());

System.Diagnostics.Trace.TraceInformation("Missing audit action types: {0}", string.Join(",", dbAuditList.Except(enumAttributeNames)));
// enumAttributeNames is a superset of dbAuditList.
Assert.That(enumAttributeNames, Is.SupersetOf(dbAuditList), @"Some types are missing in AuditActionType enum.
Please, update enum AuditActionType in /src/Microsoft/SqlServer/Management/SqlEnum/enumstructs.cs");
Expand Down
34 changes: 23 additions & 11 deletions src/FunctionalTest/Smo/GeneralFunctionality/DatabaseSmoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,31 @@ public void EnumObjects_Sets_Synonym_Schema_And_Other_Properties()
};

syn.Create();
var script = database.ExecutionManager.RecordQueryText(() =>
{
// Now, we retrieve the same object we just created by calling EnumObjects()
var objs = database.EnumObjects(DatabaseObjectTypes.Synonym, _SMO.SortOrder.Schema);
var synobj = objs.Rows.Cast<System.Data.DataRow>().Where(r => (string)r["Name"] == expectedSynName).Single();

// Now, we retrieve the same object we just created by calling EnumObjects()
var objs = database.EnumObjects(DatabaseObjectTypes.Synonym);
var synobj = objs.Rows.Cast<System.Data.DataRow>().Where(r => (string)r["Name"] == expectedSynName).Single();

// The original bug was that Schema was coming back as blank, because there was an assumption
// that synonyms did not have a schema (which was incorrect)
Assert.That(synobj["Schema"], Is.EqualTo(expectedSynSchema), "Unexpected value for Schema");
// The original bug was that Schema was coming back as blank, because there was an assumption
// that synonyms did not have a schema (which was incorrect)
Assert.That(synobj["Schema"], Is.EqualTo(expectedSynSchema), "Unexpected value for Schema");

// While we are at it, let's also check the other properties...
Assert.That(synobj["DatabaseObjectTypes"], Is.EqualTo("Synonym"), "Unexpected value for DatabaseObjectTypes");
Assert.That(synobj["Name"], Is.EqualTo(expectedSynName), "Unexpected value for Name");
Assert.That(synobj["Urn"], Is.EqualTo(syn.Urn.ToString()), "Unexpected value for Urn");
// While we are at it, let's also check the other properties...
Assert.That(synobj["DatabaseObjectTypes"], Is.EqualTo("Synonym"), "Unexpected value for DatabaseObjectTypes");
Assert.That(synobj["Name"], Is.EqualTo(expectedSynName), "Unexpected value for Name");
Assert.That(synobj["Urn"], Is.EqualTo(syn.Urn.ToString()), "Unexpected value for Urn");
}, alsoExecute: true);
Assert.That(script.ToSingleString(), Contains.Substring("ORDER BY [Schema]"), "EnumObjects (SortOrder.Schema)");
if (database.DatabaseEngineType == DatabaseEngineType.Standalone)
{
script = database.ExecutionManager.RecordQueryText(() => database.EnumObjects(), alsoExecute: true);
Assert.That(script.ToSingleString(), Contains.Substring("ORDER BY [DatabaseObjectTypes]"), "EnumObjects()");
}
script = database.ExecutionManager.RecordQueryText(() => database.EnumObjects(DatabaseObjectTypes.Table, _SMO.SortOrder.Name), alsoExecute: true);
Assert.That(script.ToSingleString(), Contains.Substring("ORDER BY [Name]"), "EnumObjects()");
script = database.ExecutionManager.RecordQueryText(() => database.EnumObjects(DatabaseObjectTypes.View, _SMO.SortOrder.Urn), alsoExecute: true);
Assert.That(script.ToSingleString(), Contains.Substring("ORDER BY [Urn]"), "EnumObjects()");
});
}

Expand Down
1 change: 0 additions & 1 deletion src/FunctionalTest/Smo/GeneralFunctionality/DwSmoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public void Server_Databases_collection_enumerates_without_exception()
}

});
Assert.That(databases.FirstOrDefault(d => d.EndsWith("Unknown")), Is.Not.Null, "Expected at least one Unknown engine edition. Make sure the test server has a paused DW instance. " + String.Join(",", databases));
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright (c) Microsoft.
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Test.Manageability.Utils.TestFramework;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;
using Assert = NUnit.Framework.Assert;

namespace Microsoft.SqlServer.Test.SMO.GeneralFunctionality
{
[TestClass]
[UnsupportedDatabaseEngineEdition(DatabaseEngineEdition.SqlOnDemand)]
public class PermissionsEnumTests : SqlTestBase
{
[TestMethod]
public void PermEnum_DatabasePermissionSetValue_enum_is_complete()
{
ExecuteTest(() =>
{
CompareEnumToServerPermissions(typeof(DatabasePermissionSetValue), @"select type, permission_name from sys.fn_builtin_permissions('DATABASE')");
});
}

[TestMethod]
public void PermEnum_ServerPermissionSetValue_enum_is_complete()
{
ExecuteTest(() =>
{
CompareEnumToServerPermissions(typeof(ServerPermissionSetValue), @"select type, permission_name from sys.fn_builtin_permissions('SERVER')");
});
}

[TestMethod]
public void PermEnum_ObjectPermissionSetValue_enum_is_complete()
{
ExecuteTest(() =>
{
CompareEnumToServerPermissions(typeof(ObjectPermissionSetValue), @"select type, permission_name from sys.fn_builtin_permissions(DEFAULT) where class_desc <> 'SERVER' and class_desc <> 'DATABASE'");
});
}
private void CompareEnumToServerPermissions(Type enumType, string permissionQuery)
{
var permissionTypes = GetAttributeValues<PermissionTypeAttribute>(enumType);
var permissionNames = GetAttributeValues<PermissionNameAttribute>(enumType);
var permissionList = ServerContext.ConnectionContext.ExecuteWithResults(permissionQuery).Tables[0].Rows.Cast<DataRow>();
var maxValue = Enum.GetValues(enumType).Cast<int>().Max();
var textInfo = new CultureInfo("en-US", false).TextInfo;
var missingValues = new StringBuilder();
foreach (var row in permissionList)
{
var name = row["permission_name"].ToString().Trim();
var type = row["type"].ToString().Trim();
if (!permissionNames.Contains(name) || !permissionTypes.Contains(type))
{
var enumName = new StringBuilder();
foreach (var s in name.Split(' '))
{
enumName.Append(textInfo.ToTitleCase(s.ToLowerInvariant()));
}
enumName.Append($" = {++maxValue},");
missingValues.Append($"{Environment.NewLine}[PermissionType(\"{type}\")]{Environment.NewLine}[PermissionName(\"{name}\")]{Environment.NewLine}{enumName}{Environment.NewLine}");
}
}
Assert.That(missingValues.ToString(), Is.Empty, $"{ enumType.Name} is incomplete. Add the missing values.");
}
/// <summary>
/// Returns the set of string attribute values associated with the given enumeration.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="enumType"></param>
/// <returns></returns>
static internal IEnumerable<string> GetAttributeValues<T>(Type enumType) where T: StringValueAttribute {
return new HashSet<string>(Enum.GetNames(enumType).Select(n => enumType.GetMember(n).Single().GetCustomAttributes(typeof(T), false).Cast<T>().Single().Value));
}
}
}
Loading