diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Resources/TSqlMockSessions/SqlAuthv12MockTests.xml b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Resources/TSqlMockSessions/SqlAuthv12MockTests.xml index 02e4c3036230..860b9c28369d 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Resources/TSqlMockSessions/SqlAuthv12MockTests.xml +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Resources/TSqlMockSessions/SqlAuthv12MockTests.xml @@ -1,7 +1,808 @@ + + SqlAuthv12MockTests.SetAzureSqlDatabaseWithSqlAuthv12 + master + + SELECT + [db].[name], + [db].[database_id], + [db].[create_date], + [db].[collation_name], + [db].[is_read_only], + [db].[is_query_store_on], + [db].[is_recursive_triggers_on], + [db].[is_federation_member], + CONVERT (bit, CASE WHEN [db].[name] in ('master') THEN 1 ELSE [db].[is_distributor] END) AS [is_system_object], + CONVERT (int, + CASE + WHEN [db].[is_in_standby] = 1 THEN 0x0040 + ELSE 0 + END | + CASE + WHEN [db].[is_cleanly_shutdown] = 1 THEN 0x0080 + ELSE 0 + END | + CASE [db].[state] + WHEN 0 THEN 0x0001 -- NORMAL + WHEN 1 THEN 0x0002 -- RESTORING + WHEN 2 THEN 0x0008 -- RECOVERING + WHEN 3 THEN 0x0004 -- RECOVERY_PENDING + WHEN 4 THEN 0x0010 -- SUSPECT + WHEN 5 THEN 0x0100 -- EMERGENCY + WHEN 6 THEN 0x0020 -- OFFLINE + WHEN 7 THEN 0x0400 -- COPYING + WHEN 9 THEN 0x0800 -- CREATING + WHEN 10 THEN 0x1000 -- OFFLINE_SECONDARY + ELSE 0x0010 -- SUSPECT + END) AS [status] + FROM [sys].[databases] AS [db] + WHERE ([db].[name] = testdb1 OR testdb1 IS NULL) + + + + + + + + + + + + + + + + + + + + + + + + + + + + testdb1 + 5 + 2014-12-22T16:56:09.243-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + false + 1 +
+
+
+
+ + SqlAuthv12MockTests.SetAzureSqlDatabaseWithSqlAuthv12 + testdb1 + SELECT DatabasePropertyEx(testdb1, 'Edition') as edition, DatabasePropertyEx(testdb1, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb1, 'MaxSizeInBytes') as maxSizeBytes + + + + + + + + + + + + + + + + + + + + + Basic + Basic + 1073741824 +
+
+
+
+ + SqlAuthv12MockTests.SetAzureSqlDatabaseWithSqlAuthv12 + master + + SELECT + [db].[name], + [db].[database_id], + [db].[create_date], + [db].[collation_name], + [db].[is_read_only], + [db].[is_query_store_on], + [db].[is_recursive_triggers_on], + [db].[is_federation_member], + CONVERT (bit, CASE WHEN [db].[name] in ('master') THEN 1 ELSE [db].[is_distributor] END) AS [is_system_object], + CONVERT (int, + CASE + WHEN [db].[is_in_standby] = 1 THEN 0x0040 + ELSE 0 + END | + CASE + WHEN [db].[is_cleanly_shutdown] = 1 THEN 0x0080 + ELSE 0 + END | + CASE [db].[state] + WHEN 0 THEN 0x0001 -- NORMAL + WHEN 1 THEN 0x0002 -- RESTORING + WHEN 2 THEN 0x0008 -- RECOVERING + WHEN 3 THEN 0x0004 -- RECOVERY_PENDING + WHEN 4 THEN 0x0010 -- SUSPECT + WHEN 5 THEN 0x0100 -- EMERGENCY + WHEN 6 THEN 0x0020 -- OFFLINE + WHEN 7 THEN 0x0400 -- COPYING + WHEN 9 THEN 0x0800 -- CREATING + WHEN 10 THEN 0x1000 -- OFFLINE_SECONDARY + ELSE 0x0010 -- SUSPECT + END) AS [status] + FROM [sys].[databases] AS [db] + WHERE ([db].[name] = testdb2 OR testdb2 IS NULL) + + + + + + + + + + + + + + + + + + + + + + + + + + + + testdb2 + 6 + 2014-12-22T16:57:51.347-08:00 + Japanese_CI_AS + false + false + false + false + false + 1 +
+
+
+
+ + SqlAuthv12MockTests.SetAzureSqlDatabaseWithSqlAuthv12 + testdb2 + SELECT DatabasePropertyEx(testdb2, 'Edition') as edition, DatabasePropertyEx(testdb2, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb2, 'MaxSizeInBytes') as maxSizeBytes + + + + + + + + + + + + + + + + + + + + + Standard + S0 + 107374182400 +
+
+
+
+ + SqlAuthv12MockTests.SetAzureSqlDatabaseWithSqlAuthv12 + master + + SELECT + [db].[name], + [db].[database_id], + [db].[create_date], + [db].[collation_name], + [db].[is_read_only], + [db].[is_query_store_on], + [db].[is_recursive_triggers_on], + [db].[is_federation_member], + CONVERT (bit, CASE WHEN [db].[name] in ('master') THEN 1 ELSE [db].[is_distributor] END) AS [is_system_object], + CONVERT (int, + CASE + WHEN [db].[is_in_standby] = 1 THEN 0x0040 + ELSE 0 + END | + CASE + WHEN [db].[is_cleanly_shutdown] = 1 THEN 0x0080 + ELSE 0 + END | + CASE [db].[state] + WHEN 0 THEN 0x0001 -- NORMAL + WHEN 1 THEN 0x0002 -- RESTORING + WHEN 2 THEN 0x0008 -- RECOVERING + WHEN 3 THEN 0x0004 -- RECOVERY_PENDING + WHEN 4 THEN 0x0010 -- SUSPECT + WHEN 5 THEN 0x0100 -- EMERGENCY + WHEN 6 THEN 0x0020 -- OFFLINE + WHEN 7 THEN 0x0400 -- COPYING + WHEN 9 THEN 0x0800 -- CREATING + WHEN 10 THEN 0x1000 -- OFFLINE_SECONDARY + ELSE 0x0010 -- SUSPECT + END) AS [status] + FROM [sys].[databases] AS [db] + WHERE ([db].[name] = testdb3alt OR testdb3alt IS NULL) + + + + + + + + + + + + + + + + + + + + + + + + + + + + testdb3alt + 7 + 2014-12-22T15:51:45.7-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + false + 1 +
+
+
+
+ + SqlAuthv12MockTests.SetAzureSqlDatabaseWithSqlAuthv12 + testdb3alt + SELECT DatabasePropertyEx(testdb3alt, 'Edition') as edition, DatabasePropertyEx(testdb3alt, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb3alt, 'MaxSizeInBytes') as maxSizeBytes + + + + + + + + + + + + + + + + + + + + + Standard + S0 + 107374182400 +
+
+
+
+ + SqlAuthv12MockTests.SetAzureSqlDatabaseWithSqlAuthv12 + master + + SELECT + [db].[name], + [db].[database_id], + [db].[create_date], + [db].[collation_name], + [db].[is_read_only], + [db].[is_query_store_on], + [db].[is_recursive_triggers_on], + [db].[is_federation_member], + CONVERT (bit, CASE WHEN [db].[name] in ('master') THEN 1 ELSE [db].[is_distributor] END) AS [is_system_object], + CONVERT (int, + CASE + WHEN [db].[is_in_standby] = 1 THEN 0x0040 + ELSE 0 + END | + CASE + WHEN [db].[is_cleanly_shutdown] = 1 THEN 0x0080 + ELSE 0 + END | + CASE [db].[state] + WHEN 0 THEN 0x0001 -- NORMAL + WHEN 1 THEN 0x0002 -- RESTORING + WHEN 2 THEN 0x0008 -- RECOVERING + WHEN 3 THEN 0x0004 -- RECOVERY_PENDING + WHEN 4 THEN 0x0010 -- SUSPECT + WHEN 5 THEN 0x0100 -- EMERGENCY + WHEN 6 THEN 0x0020 -- OFFLINE + WHEN 7 THEN 0x0400 -- COPYING + WHEN 9 THEN 0x0800 -- CREATING + WHEN 10 THEN 0x1000 -- OFFLINE_SECONDARY + ELSE 0x0010 -- SUSPECT + END) AS [status] + FROM [sys].[databases] AS [db] + WHERE ([db].[name] = testdb4 OR testdb4 IS NULL) + + + + + + + + + + + + + + + + + + + + + + + + + + + + testdb4 + 8 + 2014-12-22T16:56:31.85-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + false + 1 +
+
+
+
+ + SqlAuthv12MockTests.SetAzureSqlDatabaseWithSqlAuthv12 + testdb4 + SELECT DatabasePropertyEx(testdb4, 'Edition') as edition, DatabasePropertyEx(testdb4, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb4, 'MaxSizeInBytes') as maxSizeBytes + + + + + + + + + + + + + + + + + + + + + Standard + S0 + 268435456000 +
+
+
+
+ + SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + master + + SELECT + [db].[name], + [db].[database_id], + [db].[create_date], + [db].[collation_name], + [db].[is_read_only], + [db].[is_query_store_on], + [db].[is_recursive_triggers_on], + [db].[is_federation_member], + CONVERT (bit, CASE WHEN [db].[name] in ('master') THEN 1 ELSE [db].[is_distributor] END) AS [is_system_object], + CONVERT (int, + CASE + WHEN [db].[is_in_standby] = 1 THEN 0x0040 + ELSE 0 + END | + CASE + WHEN [db].[is_cleanly_shutdown] = 1 THEN 0x0080 + ELSE 0 + END | + CASE [db].[state] + WHEN 0 THEN 0x0001 -- NORMAL + WHEN 1 THEN 0x0002 -- RESTORING + WHEN 2 THEN 0x0008 -- RECOVERING + WHEN 3 THEN 0x0004 -- RECOVERY_PENDING + WHEN 4 THEN 0x0010 -- SUSPECT + WHEN 5 THEN 0x0100 -- EMERGENCY + WHEN 6 THEN 0x0020 -- OFFLINE + WHEN 7 THEN 0x0400 -- COPYING + WHEN 9 THEN 0x0800 -- CREATING + WHEN 10 THEN 0x1000 -- OFFLINE_SECONDARY + ELSE 0x0010 -- SUSPECT + END) AS [status] + FROM [sys].[databases] AS [db] + WHERE ([db].[name] = testdb1 OR testdb1 IS NULL) + + + + + + + + + + + + + + + + + + + + + + + + + + + + testdb1 + 5 + 2014-12-05T15:52:35.953-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + false + 1 +
+
+
+
+ + SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + testdb1 + SELECT DatabasePropertyEx(testdb1, 'Edition') as edition, DatabasePropertyEx(testdb1, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb1, 'MaxSizeInBytes') as maxSizeBytes + + + + + + + + + + + + + + + + + + + + + Standard + S0 + 268435456000 +
+
+
+
+ + SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + master + + SELECT + [db].[name], + [db].[database_id], + [db].[create_date], + [db].[collation_name], + [db].[is_read_only], + [db].[is_query_store_on], + [db].[is_recursive_triggers_on], + [db].[is_federation_member], + CONVERT (bit, CASE WHEN [db].[name] in ('master') THEN 1 ELSE [db].[is_distributor] END) AS [is_system_object], + CONVERT (int, + CASE + WHEN [db].[is_in_standby] = 1 THEN 0x0040 + ELSE 0 + END | + CASE + WHEN [db].[is_cleanly_shutdown] = 1 THEN 0x0080 + ELSE 0 + END | + CASE [db].[state] + WHEN 0 THEN 0x0001 -- NORMAL + WHEN 1 THEN 0x0002 -- RESTORING + WHEN 2 THEN 0x0008 -- RECOVERING + WHEN 3 THEN 0x0004 -- RECOVERY_PENDING + WHEN 4 THEN 0x0010 -- SUSPECT + WHEN 5 THEN 0x0100 -- EMERGENCY + WHEN 6 THEN 0x0020 -- OFFLINE + WHEN 7 THEN 0x0400 -- COPYING + WHEN 9 THEN 0x0800 -- CREATING + WHEN 10 THEN 0x1000 -- OFFLINE_SECONDARY + ELSE 0x0010 -- SUSPECT + END) AS [status] + FROM [sys].[databases] AS [db] + WHERE ([db].[name] = OR IS NULL) + + + + + + + + + + + + + + + + + + + + + + + + + + + + master + 1 + 2014-12-05T12:35:00.73-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + true + 1 +
+ + testdb1 + 5 + 2014-12-05T15:52:35.953-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + false + 1 +
+ + testdb2 + 6 + 2014-12-05T15:54:56.603-08:00 + Japanese_CI_AS + false + false + false + false + false + 1 +
+ + testdb3 + 7 + 2014-12-05T15:55:29.173-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + false + 1 +
+ + testdb4 + 8 + 2014-12-05T15:57:43.137-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + false + 1 +
+
+
+
+ + SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + master + SELECT DatabasePropertyEx(master, 'Edition') as edition, DatabasePropertyEx(master, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(master, 'MaxSizeInBytes') as maxSizeBytes + + + + + + + + + + + + + + + + + + + + + System + System2 + 5368709120 +
+
+
+
+ + SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + testdb2 + SELECT DatabasePropertyEx(testdb2, 'Edition') as edition, DatabasePropertyEx(testdb2, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb2, 'MaxSizeInBytes') as maxSizeBytes + + + + + + + + + + + + + + + + + + + + + Basic + Basic + 2147483648 +
+
+
+
+ + SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + testdb3 + SELECT DatabasePropertyEx(testdb3, 'Edition') as edition, DatabasePropertyEx(testdb3, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb3, 'MaxSizeInBytes') as maxSizeBytes + + + + + + + + + + + + + + + + + + + + + Standard + S0 + 107374182400 +
+
+
+
SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + testdb4 + SELECT DatabasePropertyEx(testdb4, 'Edition') as edition, DatabasePropertyEx(testdb4, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb4, 'MaxSizeInBytes') as maxSizeBytes + + + + + + + + + + + + + + + + + + + + + Standard + S2 + 268435456000 +
+
+
+
+ + SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 master SELECT @@ -67,7 +868,7 @@ testdb15 - 2014-12-05T15:52:35.953-08:00 + 2014-12-06T12:25:52.49-08:00SQL_Latin1_General_CP1_CI_ASfalsefalse @@ -80,7 +881,7 @@ - SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 testdb1 SELECT DatabasePropertyEx(testdb1, 'Edition') as edition, DatabasePropertyEx(testdb1, 'MaxSizeInBytes') as maxSizeBytes @@ -109,7 +910,7 @@ - SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 master SELECT @@ -145,7 +946,7 @@ ELSE 0x0010 -- SUSPECT END) AS [status] FROM [sys].[databases] AS [db] - WHERE ([db].[name] = OR IS NULL) + WHERE ([db].[name] = testdb2 OR testdb2 IS NULL) @@ -172,34 +973,10 @@ -
- master - 1 - 2014-12-05T12:35:00.73-08:00 - SQL_Latin1_General_CP1_CI_AS - false - false - false - false - true - 1 -
- - testdb1 - 5 - 2014-12-05T15:52:35.953-08:00 - SQL_Latin1_General_CP1_CI_AS - false - false - false - false - false - 1 -
testdb26 - 2014-12-05T15:54:56.603-08:00 + 2014-12-06T12:27:55.997-08:00Japanese_CI_ASfalsefalse @@ -208,37 +985,13 @@ false1
- - testdb3 - 7 - 2014-12-05T15:55:29.173-08:00 - SQL_Latin1_General_CP1_CI_AS - false - false - false - false - false - 1 -
- - testdb4 - 8 - 2014-12-05T15:57:43.137-08:00 - SQL_Latin1_General_CP1_CI_AS - false - false - false - false - false - 1 -
- SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 - master - SELECT DatabasePropertyEx(master, 'Edition') as edition, DatabasePropertyEx(master, 'MaxSizeInBytes') as maxSizeBytes + SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 + testdb2 + SELECT DatabasePropertyEx(testdb2, 'Edition') as edition, DatabasePropertyEx(testdb2, 'MaxSizeInBytes') as maxSizeBytes @@ -258,16 +1011,50 @@ - System - 5368709120 + Basic + 2147483648
- SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 - testdb2 - SELECT DatabasePropertyEx(testdb2, 'Edition') as edition, DatabasePropertyEx(testdb2, 'MaxSizeInBytes') as maxSizeBytes + SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 + master + + SELECT + [db].[name], + [db].[database_id], + [db].[create_date], + [db].[collation_name], + [db].[is_read_only], + [db].[is_query_store_on], + [db].[is_recursive_triggers_on], + [db].[is_federation_member], + CONVERT (bit, CASE WHEN [db].[name] in ('master') THEN 1 ELSE [db].[is_distributor] END) AS [is_system_object], + CONVERT (int, + CASE + WHEN [db].[is_in_standby] = 1 THEN 0x0040 + ELSE 0 + END | + CASE + WHEN [db].[is_cleanly_shutdown] = 1 THEN 0x0080 + ELSE 0 + END | + CASE [db].[state] + WHEN 0 THEN 0x0001 -- NORMAL + WHEN 1 THEN 0x0002 -- RESTORING + WHEN 2 THEN 0x0008 -- RECOVERING + WHEN 3 THEN 0x0004 -- RECOVERY_PENDING + WHEN 4 THEN 0x0010 -- SUSPECT + WHEN 5 THEN 0x0100 -- EMERGENCY + WHEN 6 THEN 0x0020 -- OFFLINE + WHEN 7 THEN 0x0400 -- COPYING + WHEN 9 THEN 0x0800 -- CREATING + WHEN 10 THEN 0x1000 -- OFFLINE_SECONDARY + ELSE 0x0010 -- SUSPECT + END) AS [status] + FROM [sys].[databases] AS [db] + WHERE ([db].[name] = testdb3 OR testdb3 IS NULL) @@ -277,8 +1064,16 @@ - - + + + + + + + + + + @@ -287,14 +1082,22 @@ - Basic - 2147483648 + testdb3 + 7 + 2014-12-06T12:28:28.81-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + false + 1
- SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 + SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 testdb3 SELECT DatabasePropertyEx(testdb3, 'Edition') as edition, DatabasePropertyEx(testdb3, 'MaxSizeInBytes') as maxSizeBytes @@ -306,8 +1109,8 @@ - - + + @@ -323,9 +1126,43 @@ - SqlAuthv12MockTests.GetAzureSqlDatabaseWithSqlAuthv12 - testdb4 - SELECT DatabasePropertyEx(testdb4, 'Edition') as edition, DatabasePropertyEx(testdb4, 'MaxSizeInBytes') as maxSizeBytes + SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 + master + + SELECT + [db].[name], + [db].[database_id], + [db].[create_date], + [db].[collation_name], + [db].[is_read_only], + [db].[is_query_store_on], + [db].[is_recursive_triggers_on], + [db].[is_federation_member], + CONVERT (bit, CASE WHEN [db].[name] in ('master') THEN 1 ELSE [db].[is_distributor] END) AS [is_system_object], + CONVERT (int, + CASE + WHEN [db].[is_in_standby] = 1 THEN 0x0040 + ELSE 0 + END | + CASE + WHEN [db].[is_cleanly_shutdown] = 1 THEN 0x0080 + ELSE 0 + END | + CASE [db].[state] + WHEN 0 THEN 0x0001 -- NORMAL + WHEN 1 THEN 0x0002 -- RESTORING + WHEN 2 THEN 0x0008 -- RECOVERING + WHEN 3 THEN 0x0004 -- RECOVERY_PENDING + WHEN 4 THEN 0x0010 -- SUSPECT + WHEN 5 THEN 0x0100 -- EMERGENCY + WHEN 6 THEN 0x0020 -- OFFLINE + WHEN 7 THEN 0x0400 -- COPYING + WHEN 9 THEN 0x0800 -- CREATING + WHEN 10 THEN 0x1000 -- OFFLINE_SECONDARY + ELSE 0x0010 -- SUSPECT + END) AS [status] + FROM [sys].[databases] AS [db] + WHERE ([db].[name] = testdb4 OR testdb4 IS NULL) @@ -335,8 +1172,16 @@ - - + + + + + + + + + + @@ -345,8 +1190,16 @@ - Standard - 268435456000 + testdb4 + 8 + 2014-12-06T12:31:55.247-08:00 + SQL_Latin1_General_CP1_CI_AS + false + false + false + false + false + 1
@@ -418,7 +1271,7 @@ testdb15 - 2014-12-06T12:25:52.49-08:00 + 2014-12-22T15:49:15.387-08:00SQL_Latin1_General_CP1_CI_ASfalsefalse @@ -433,7 +1286,7 @@ SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 testdb1 - SELECT DatabasePropertyEx(testdb1, 'Edition') as edition, DatabasePropertyEx(testdb1, 'MaxSizeInBytes') as maxSizeBytes + SELECT DatabasePropertyEx(testdb1, 'Edition') as edition, DatabasePropertyEx(testdb1, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb1, 'MaxSizeInBytes') as maxSizeBytes @@ -444,6 +1297,7 @@ + @@ -454,6 +1308,7 @@
Standard + S0268435456000
@@ -526,7 +1381,7 @@ testdb26 - 2014-12-06T12:27:55.997-08:00 + 2014-12-22T15:51:10.693-08:00Japanese_CI_ASfalsefalse @@ -541,7 +1396,7 @@ SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 testdb2 - SELECT DatabasePropertyEx(testdb2, 'Edition') as edition, DatabasePropertyEx(testdb2, 'MaxSizeInBytes') as maxSizeBytes + SELECT DatabasePropertyEx(testdb2, 'Edition') as edition, DatabasePropertyEx(testdb2, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb2, 'MaxSizeInBytes') as maxSizeBytes @@ -552,6 +1407,7 @@ + @@ -562,6 +1418,7 @@
Basic + Basic2147483648
@@ -634,7 +1491,7 @@ testdb37 - 2014-12-06T12:28:28.81-08:00 + 2014-12-22T15:51:45.7-08:00SQL_Latin1_General_CP1_CI_ASfalsefalse @@ -649,7 +1506,7 @@ SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 testdb3 - SELECT DatabasePropertyEx(testdb3, 'Edition') as edition, DatabasePropertyEx(testdb3, 'MaxSizeInBytes') as maxSizeBytes + SELECT DatabasePropertyEx(testdb3, 'Edition') as edition, DatabasePropertyEx(testdb3, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb3, 'MaxSizeInBytes') as maxSizeBytes @@ -660,6 +1517,7 @@ + @@ -670,6 +1528,7 @@
Standard + S0107374182400
@@ -742,7 +1601,7 @@ testdb48 - 2014-12-06T12:31:55.247-08:00 + 2014-12-22T15:53:51.507-08:00SQL_Latin1_General_CP1_CI_ASfalsefalse @@ -757,7 +1616,7 @@ SqlAuthv12MockTests.NewAzureSqlDatabaseWithSqlAuthv12 testdb4 - SELECT DatabasePropertyEx(testdb4, 'Edition') as edition, DatabasePropertyEx(testdb4, 'MaxSizeInBytes') as maxSizeBytes + SELECT DatabasePropertyEx(testdb4, 'Edition') as edition, DatabasePropertyEx(testdb4, 'ServiceObjective') as serviceObjective, DatabasePropertyEx(testdb4, 'MaxSizeInBytes') as maxSizeBytes @@ -768,6 +1627,7 @@ + @@ -778,12 +1638,13 @@
Standard + S2268435456000
- + SqlAuthv12MockTests.SetAzureSqlDatabaseWithSqlAuthv12 master diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs index 68d9769792f4..2eb455284457 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs @@ -132,6 +132,30 @@ private void ParameterValidation() ErrorCategory.InvalidArgument, null)); } + + // The API doesn't allow supplying a database name and and operation GUID. + if (this.MyInvocation.BoundParameters.ContainsKey("DatabaseName") && + this.MyInvocation.BoundParameters.ContainsKey("OperationGuid")) + { + this.WriteError(new ErrorRecord( + new PSArgumentException( + String.Format(Resources.InvalidParameterCombination, "DatabaseName", "OperationGuid")), + string.Empty, + ErrorCategory.InvalidArgument, + null)); + } + + // The API doesn't allow supplying a database name and and operation GUID. + if (this.MyInvocation.BoundParameters.ContainsKey("Database") && + this.MyInvocation.BoundParameters.ContainsKey("OperationGuid")) + { + this.WriteError(new ErrorRecord( + new PSArgumentException( + String.Format(Resources.InvalidParameterCombination, "Database", "OperationGuid")), + string.Empty, + ErrorCategory.InvalidArgument, + null)); + } } /// diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/TSqlConnectionContext.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/TSqlConnectionContext.cs index 73181b8572db..8b99c07f4cc0 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/TSqlConnectionContext.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/TSqlConnectionContext.cs @@ -382,7 +382,7 @@ public Database CreateNewDatabase( } SqlCollationCheck(databaseCollation); - + commandText = string.Format( commandText, SqlEscape(databaseName), @@ -413,21 +413,21 @@ public Database CreateNewDatabase( /// The string to verify private void SqlCollationCheck(string databaseCollation) { - if(string.IsNullOrEmpty (databaseCollation)) + if (string.IsNullOrEmpty(databaseCollation)) { return; } - bool isValid = databaseCollation.All( (c) => + bool isValid = databaseCollation.All((c) => { - if(!char.IsLetterOrDigit(c) && c != '_') + if (!char.IsLetterOrDigit(c) && c != '_') { return false; } return true; }); - if(!isValid) + if (!isValid) { throw new ArgumentException("Invalid Collation", "Collation"); } @@ -555,8 +555,26 @@ public ServiceObjective[] GetServiceObjectives() { Context = this, Enabled = true, - Id = new Guid("dd6d99bb-f193-4ec1-86f2-43d3bccbc49c "), - IsDefault = true, + Id = new Guid("26E021DB-F1F9-4C98-84C6-92AF8EF433D7"), + IsDefault = false, + IsSystem = true, + Name = "System" + }, + new ServiceObjective() + { + Context = this, + Enabled = true, + Id = new Guid("620323BF-2879-4807-B30D-C2E6D7B3B3AA"), + IsDefault = false, + IsSystem = true, + Name = "System2" + }, + new ServiceObjective() + { + Context = this, + Enabled = true, + Id = new Guid("dd6d99bb-f193-4ec1-86f2-43d3bccbc49c"), + IsDefault = false, IsSystem = false, Name = "Basic" }, @@ -564,22 +582,22 @@ public ServiceObjective[] GetServiceObjectives() { Context = this, Enabled = true, - Id = new Guid("f1173c43-91bd-4aaa-973c-54e79e15235b "), - IsDefault = false, + Id = new Guid("f1173c43-91bd-4aaa-973c-54e79e15235b"), + IsDefault = true, IsSystem = false, Name = "S0" }, - new ServiceObjective() - { + new ServiceObjective() + { Context = this, Enabled = true, - Id = new Guid("1b1ebd4d-d903-4baa-97f9-4ea675f5e928 "), + Id = new Guid("1b1ebd4d-d903-4baa-97f9-4ea675f5e928"), IsDefault = false, IsSystem = false, Name = "S1" }, - new ServiceObjective() - { + new ServiceObjective() + { Context = this, Enabled = true, Id = new Guid("455330e1-00cd-488b-b5fa-177c226f28b7"), @@ -587,26 +605,35 @@ public ServiceObjective[] GetServiceObjectives() IsSystem = false, Name = "S2" }, - new ServiceObjective() - { + new ServiceObjective() + { + Context = this, + Enabled = true, + Id = new Guid("789681B8-CA10-4EB0-BDF2-E0B050601B40"), + IsDefault = false, + IsSystem = false, + Name = "S3" + }, + new ServiceObjective() + { Context = this, Enabled = true, - Id = new Guid("7203483a-c4fb-4304-9e9f-17c71c904f5d "), + Id = new Guid("7203483a-c4fb-4304-9e9f-17c71c904f5d"), IsDefault = false, IsSystem = false, Name = "P1" }, - new ServiceObjective() - { + new ServiceObjective() + { Context = this, Enabled = true, - Id = new Guid("a7d1b92d-c987-4375-b54d-2b1d0e0f5bb0 "), + Id = new Guid("a7d1b92d-c987-4375-b54d-2b1d0e0f5bb0"), IsDefault = false, IsSystem = false, Name = "P2" }, - new ServiceObjective() - { + new ServiceObjective() + { Context = this, Enabled = true, Id = new Guid("a7c4c615-cfb1-464b-b252-925be0a19446"), @@ -756,8 +783,8 @@ private void GetDatabaseProperties(Database db) string commandText = "SELECT " + "DatabasePropertyEx(@name, 'Edition') as edition, " + + "DatabasePropertyEx(@name, 'ServiceObjective') as serviceObjective, " + "DatabasePropertyEx(@name, 'MaxSizeInBytes') as maxSizeBytes"; - //TODO: need to get current SLO here. builder["Database"] = db.Name; using (var connection = CreateConnection()) @@ -776,8 +803,9 @@ private void GetDatabaseProperties(Database db) { while (reader.Read()) { - db.MaxSizeBytes = (long)reader["maxSizeBytes"]; - db.Edition = (string)reader["edition"]; + db.MaxSizeBytes = ConvertFromDbValue(reader["maxSizeBytes"]); + db.Edition = ConvertFromDbValue(reader["edition"]); + db.ServiceObjectiveName = ConvertFromDbValue(reader["serviceObjective"]); } } } @@ -787,6 +815,11 @@ private void GetDatabaseProperties(Database db) { db.MaxSizeGB = (int)(db.MaxSizeBytes / (1024 * 1024 * 1024)); } + if (!string.IsNullOrEmpty(db.ServiceObjectiveName)) + { + db.ServiceObjective = GetServiceObjective(db.ServiceObjectiveName); + db.ServiceObjectiveId = db.ServiceObjective.Id; + } builder["Database"] = null; }