mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
added support for more object scripting (#435)
* added support for more object scripting * allow using script options in scripting * added tests for scripting all objects
This commit is contained in:
@@ -13,7 +13,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Metadata.Contracts
|
|||||||
Table = 0,
|
Table = 0,
|
||||||
View = 1,
|
View = 1,
|
||||||
SProc = 2,
|
SProc = 2,
|
||||||
Function = 3
|
Function = 3,
|
||||||
|
Schema = 4,
|
||||||
|
Database = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
AddSupportedType(DeclarationType.Table, GetTableScripts, "Table", "table");
|
AddSupportedType(DeclarationType.Table, GetTableScripts, "Table", "table");
|
||||||
AddSupportedType(DeclarationType.View, GetViewScripts, "View", "view");
|
AddSupportedType(DeclarationType.View, GetViewScripts, "View", "view");
|
||||||
AddSupportedType(DeclarationType.StoredProcedure, GetStoredProcedureScripts, "Procedure", "stored procedure");
|
AddSupportedType(DeclarationType.StoredProcedure, GetStoredProcedureScripts, "Procedure", "stored procedure");
|
||||||
|
AddSupportedType(DeclarationType.Schema, GetSchemaScripts, "Schema", "schema");
|
||||||
|
AddSupportedType(DeclarationType.Database, GetDatabaseScripts, "Database", "database");
|
||||||
AddSupportedType(DeclarationType.UserDefinedDataType, GetUserDefinedDataTypeScripts, "Type", "user-defined data type");
|
AddSupportedType(DeclarationType.UserDefinedDataType, GetUserDefinedDataTypeScripts, "Type", "user-defined data type");
|
||||||
AddSupportedType(DeclarationType.UserDefinedTableType, GetUserDefinedTableTypeScripts, "Type", "user-defined table type");
|
AddSupportedType(DeclarationType.UserDefinedTableType, GetUserDefinedTableTypeScripts, "Type", "user-defined table type");
|
||||||
AddSupportedType(DeclarationType.Synonym, GetSynonymScripts, "Synonym", "");
|
AddSupportedType(DeclarationType.Synonym, GetSynonymScripts, "Synonym", "");
|
||||||
@@ -43,7 +45,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
{
|
{
|
||||||
Table smoObject = string.IsNullOrEmpty(schemaName) ? new Table(this.Database, objectName) : new Table(this.Database, objectName, schemaName);
|
Table smoObject = string.IsNullOrEmpty(schemaName) ? new Table(this.Database, objectName) : new Table(this.Database, objectName, schemaName);
|
||||||
smoObject.Refresh();
|
smoObject.Refresh();
|
||||||
return smoObject.Script();
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -64,7 +66,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
{
|
{
|
||||||
View smoObject = string.IsNullOrEmpty(schemaName) ? new View(this.Database, objectName) : new View(this.Database, objectName, schemaName);
|
View smoObject = string.IsNullOrEmpty(schemaName) ? new View(this.Database, objectName) : new View(this.Database, objectName, schemaName);
|
||||||
smoObject.Refresh();
|
smoObject.Refresh();
|
||||||
return smoObject.Script();
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -85,7 +87,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
{
|
{
|
||||||
StoredProcedure smoObject = string.IsNullOrEmpty(schemaName) ? new StoredProcedure(this.Database, objectName) : new StoredProcedure(this.Database, objectName, schemaName);
|
StoredProcedure smoObject = string.IsNullOrEmpty(schemaName) ? new StoredProcedure(this.Database, objectName) : new StoredProcedure(this.Database, objectName, schemaName);
|
||||||
smoObject.Refresh();
|
smoObject.Refresh();
|
||||||
return smoObject.Script();
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -94,6 +96,48 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Script a Schema using SMO
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectName">Schema name</param>
|
||||||
|
/// <param name="schemaName">Schema name</param>
|
||||||
|
/// <returns>String collection of scripts</returns>
|
||||||
|
internal StringCollection GetSchemaScripts(string objectName, string schemaName, ScriptingOptions scriptingOptions = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Schema smoObject = new Schema(this.Database, objectName);
|
||||||
|
smoObject.Refresh();
|
||||||
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Write(LogLevel.Error,"Exception at PeekDefinition GetSchemaScripts : " + ex.Message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Script a Database using SMO
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectName">Database name</param>
|
||||||
|
/// <param name="schemaName">Schema name</param>
|
||||||
|
/// <returns>String collection of scripts</returns>
|
||||||
|
internal StringCollection GetDatabaseScripts(string objectName, string schemaName, ScriptingOptions scriptingOptions = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Database smoObject = new Database(new Server(this.serverConnection), objectName);
|
||||||
|
smoObject.Refresh();
|
||||||
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Write(LogLevel.Error,"Exception at PeekDefinition GetDatabaseScripts : " + ex.Message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Script a UserDefinedDataType using SMO
|
/// Script a UserDefinedDataType using SMO
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -106,7 +150,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
{
|
{
|
||||||
UserDefinedDataType smoObject = string.IsNullOrEmpty(schemaName) ? new UserDefinedDataType(this.Database, objectName) : new UserDefinedDataType(this.Database, objectName, schemaName);
|
UserDefinedDataType smoObject = string.IsNullOrEmpty(schemaName) ? new UserDefinedDataType(this.Database, objectName) : new UserDefinedDataType(this.Database, objectName, schemaName);
|
||||||
smoObject.Refresh();
|
smoObject.Refresh();
|
||||||
return smoObject.Script();
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -127,7 +171,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
{
|
{
|
||||||
UserDefinedTableType smoObject = string.IsNullOrEmpty(schemaName) ? new UserDefinedTableType(this.Database, objectName) : new UserDefinedTableType(this.Database, objectName, schemaName);
|
UserDefinedTableType smoObject = string.IsNullOrEmpty(schemaName) ? new UserDefinedTableType(this.Database, objectName) : new UserDefinedTableType(this.Database, objectName, schemaName);
|
||||||
smoObject.Refresh();
|
smoObject.Refresh();
|
||||||
return smoObject.Script();
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -148,7 +192,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
{
|
{
|
||||||
Synonym smoObject = string.IsNullOrEmpty(schemaName) ? new Synonym(this.Database, objectName) : new Synonym(this.Database, objectName, schemaName);
|
Synonym smoObject = string.IsNullOrEmpty(schemaName) ? new Synonym(this.Database, objectName) : new Synonym(this.Database, objectName, schemaName);
|
||||||
smoObject.Refresh();
|
smoObject.Refresh();
|
||||||
return smoObject.Script();
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -169,7 +213,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
{
|
{
|
||||||
UserDefinedFunction smoObject = string.IsNullOrEmpty(schemaName) ? new UserDefinedFunction(this.Database, objectName) : new UserDefinedFunction(this.Database, objectName, schemaName);
|
UserDefinedFunction smoObject = string.IsNullOrEmpty(schemaName) ? new UserDefinedFunction(this.Database, objectName) : new UserDefinedFunction(this.Database, objectName, schemaName);
|
||||||
smoObject.Refresh();
|
smoObject.Refresh();
|
||||||
return smoObject.Script();
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -190,7 +234,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
{
|
{
|
||||||
UserDefinedFunction smoObject = string.IsNullOrEmpty(schemaName) ? new UserDefinedFunction(this.Database, objectName) : new UserDefinedFunction(this.Database, objectName, schemaName);
|
UserDefinedFunction smoObject = string.IsNullOrEmpty(schemaName) ? new UserDefinedFunction(this.Database, objectName) : new UserDefinedFunction(this.Database, objectName, schemaName);
|
||||||
smoObject.Refresh();
|
smoObject.Refresh();
|
||||||
return smoObject.Script();
|
return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,12 +79,20 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
statement = string.Format("{0} smoObject = new {0}(this.Database, objectName);", typeProperty["Name"]);
|
// If it's a database
|
||||||
|
if (typeProperty["AccessClass"] == "Database")
|
||||||
|
{
|
||||||
|
statement = string.Format("{0} smoObject = new {0}(new Server(this.serverConnection), objectName);", typeProperty["Name"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
statement = string.Format("{0} smoObject = new {0}(this.Database, objectName);", typeProperty["Name"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PushIndent(indent);
|
PushIndent(indent);
|
||||||
WriteLine(statement);
|
WriteLine(statement);
|
||||||
WriteLine("smoObject.Refresh();");
|
WriteLine("smoObject.Refresh();");
|
||||||
WriteLine("return smoObject.Script();");
|
WriteLine("return (scriptingOptions == null) ? smoObject.Script() : smoObject.Script(scriptingOptions);");
|
||||||
PopIndent();
|
PopIndent();
|
||||||
WriteLine("}");
|
WriteLine("}");
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,20 @@ SupportsSchemaQuery - Boolean denoting if the object can be queried/accessed usi
|
|||||||
<QuickInfoType>stored procedure</QuickInfoType>
|
<QuickInfoType>stored procedure</QuickInfoType>
|
||||||
<SupportsSchemaQuery>true</SupportsSchemaQuery>
|
<SupportsSchemaQuery>true</SupportsSchemaQuery>
|
||||||
</Type>
|
</Type>
|
||||||
|
<Type>
|
||||||
|
<Name>Schema</Name>
|
||||||
|
<CreateSyntax>Schema</CreateSyntax>
|
||||||
|
<AccessClass>Schema</AccessClass>
|
||||||
|
<QuickInfoType>schema</QuickInfoType>
|
||||||
|
<SupportsSchemaQuery>false</SupportsSchemaQuery>
|
||||||
|
</Type>
|
||||||
|
<Type>
|
||||||
|
<Name>Database</Name>
|
||||||
|
<CreateSyntax>Database</CreateSyntax>
|
||||||
|
<AccessClass>Database</AccessClass>
|
||||||
|
<QuickInfoType>database</QuickInfoType>
|
||||||
|
<SupportsSchemaQuery>false</SupportsSchemaQuery>
|
||||||
|
</Type>
|
||||||
<Type>
|
<Type>
|
||||||
<Name>UserDefinedDataType</Name>
|
<Name>UserDefinedDataType</Name>
|
||||||
<CreateSyntax>Type</CreateSyntax>
|
<CreateSyntax>Type</CreateSyntax>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
|||||||
using Microsoft.SqlTools.ServiceLayer.Metadata.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.Metadata.Contracts;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Scripting.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.Scripting.Contracts;
|
||||||
using Microsoft.SqlTools.Utility;
|
using Microsoft.SqlTools.Utility;
|
||||||
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
||||||
{
|
{
|
||||||
@@ -231,19 +232,27 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
{
|
{
|
||||||
Scripter scripter = new Scripter(bindingContext.ServerConnection, connInfo);
|
Scripter scripter = new Scripter(bindingContext.ServerConnection, connInfo);
|
||||||
StringCollection results = null;
|
StringCollection results = null;
|
||||||
if (metadata.MetadataType == MetadataType.Table)
|
switch(metadata.MetadataTypeName)
|
||||||
{
|
{
|
||||||
results = scripter.GetTableScripts(metadata.Name, metadata.Schema);
|
case ("Table"):
|
||||||
|
results = scripter.GetTableScripts(metadata.Name, metadata.Schema);
|
||||||
|
break;
|
||||||
|
case ("View"):
|
||||||
|
results = scripter.GetViewScripts(metadata.Name, metadata.Schema);
|
||||||
|
break;
|
||||||
|
case("StoredProcedure"):
|
||||||
|
results = scripter.GetStoredProcedureScripts(metadata.Name, metadata.Schema);
|
||||||
|
break;
|
||||||
|
case("Schema"):
|
||||||
|
results = scripter.GetSchemaScripts(metadata.Name, metadata.Schema);
|
||||||
|
break;
|
||||||
|
case("Database"):
|
||||||
|
results = scripter.GetDatabaseScripts(metadata.Name, metadata.Schema);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
results = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (metadata.MetadataType == MetadataType.SProc)
|
|
||||||
{
|
|
||||||
results = scripter.GetStoredProcedureScripts(metadata.Name, metadata.Schema);
|
|
||||||
}
|
|
||||||
else if (metadata.MetadataType == MetadataType.View)
|
|
||||||
{
|
|
||||||
results = scripter.GetViewScripts(metadata.Name, metadata.Schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder builder = null;
|
StringBuilder builder = null;
|
||||||
if (results != null)
|
if (results != null)
|
||||||
{
|
{
|
||||||
@@ -287,7 +296,42 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
ConnectionInfo connInfo,
|
ConnectionInfo connInfo,
|
||||||
ObjectMetadata metadata)
|
ObjectMetadata metadata)
|
||||||
{
|
{
|
||||||
return null;
|
Scripter scripter = new Scripter(bindingContext.ServerConnection, connInfo);
|
||||||
|
StringCollection results = null;
|
||||||
|
ScriptingOptions options = new ScriptingOptions();
|
||||||
|
options.ScriptDrops = true;
|
||||||
|
switch(metadata.MetadataTypeName)
|
||||||
|
{
|
||||||
|
case ("Table"):
|
||||||
|
results = scripter.GetTableScripts(metadata.Name, metadata.Schema, options);
|
||||||
|
break;
|
||||||
|
case ("View"):
|
||||||
|
results = scripter.GetViewScripts(metadata.Name, metadata.Schema, options);
|
||||||
|
break;
|
||||||
|
case("StoredProcedure"):
|
||||||
|
results = scripter.GetStoredProcedureScripts(metadata.Name, metadata.Schema, options);
|
||||||
|
break;
|
||||||
|
case("Schema"):
|
||||||
|
results = scripter.GetSchemaScripts(metadata.Name, metadata.Schema, options);
|
||||||
|
break;
|
||||||
|
case("Database"):
|
||||||
|
results = scripter.GetDatabaseScripts(metadata.Name, metadata.Schema, options);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
results = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
StringBuilder builder = null;
|
||||||
|
if (results != null)
|
||||||
|
{
|
||||||
|
builder = new StringBuilder();
|
||||||
|
foreach (var result in results)
|
||||||
|
{
|
||||||
|
builder.AppendLine(result);
|
||||||
|
builder.AppendLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return builder != null ? builder.ToString() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
|||||||
{
|
{
|
||||||
private const string SchemaName = "dbo";
|
private const string SchemaName = "dbo";
|
||||||
private const string TableName = "spt_monitor";
|
private const string TableName = "spt_monitor";
|
||||||
|
private const string ViewName = "test";
|
||||||
|
private const string DatabaseName = "test-db";
|
||||||
|
private const string StoredProcName = "test-sp";
|
||||||
|
private string[] objects = new string[5] {"Table", "View", "Schema", "Database", "SProc"};
|
||||||
|
|
||||||
private LiveConnectionHelper.TestConnectionResult GetLiveAutoCompleteTestObjects()
|
private LiveConnectionHelper.TestConnectionResult GetLiveAutoCompleteTestObjects()
|
||||||
{
|
{
|
||||||
@@ -40,8 +44,44 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ObjectMetadata GenerateMetadata(string objectType)
|
||||||
|
{
|
||||||
|
var metadata = new ObjectMetadata()
|
||||||
|
{
|
||||||
|
Schema = SchemaName,
|
||||||
|
Name = objectType
|
||||||
|
};
|
||||||
|
switch(objectType)
|
||||||
|
{
|
||||||
|
case("Table"):
|
||||||
|
metadata.MetadataType = MetadataType.Table;
|
||||||
|
metadata.Name = TableName;
|
||||||
|
break;
|
||||||
|
case("View"):
|
||||||
|
metadata.MetadataType = MetadataType.View;
|
||||||
|
metadata.Name = ViewName;
|
||||||
|
break;
|
||||||
|
case("Database"):
|
||||||
|
metadata.MetadataType = MetadataType.Database;
|
||||||
|
metadata.Name = DatabaseName;
|
||||||
|
break;
|
||||||
|
case("Schema"):
|
||||||
|
metadata.MetadataType = MetadataType.Schema;
|
||||||
|
metadata.MetadataTypeName = SchemaName;
|
||||||
|
break;
|
||||||
|
case("SProc"):
|
||||||
|
metadata.MetadataType = MetadataType.SProc;
|
||||||
|
metadata.MetadataTypeName = StoredProcName;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
metadata.MetadataType = MetadataType.Table;
|
||||||
|
metadata.Name = TableName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<Mock<RequestContext<ScriptingScriptAsResult>>> SendAndValidateScriptRequest(ScriptOperation operation)
|
private async Task<Mock<RequestContext<ScriptingScriptAsResult>>> SendAndValidateScriptRequest(ScriptOperation operation, string objectType)
|
||||||
{
|
{
|
||||||
var result = GetLiveAutoCompleteTestObjects();
|
var result = GetLiveAutoCompleteTestObjects();
|
||||||
var requestContext = new Mock<RequestContext<ScriptingScriptAsResult>>();
|
var requestContext = new Mock<RequestContext<ScriptingScriptAsResult>>();
|
||||||
@@ -51,13 +91,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
|||||||
{
|
{
|
||||||
OwnerUri = result.ConnectionInfo.OwnerUri,
|
OwnerUri = result.ConnectionInfo.OwnerUri,
|
||||||
Operation = operation,
|
Operation = operation,
|
||||||
Metadata = new ObjectMetadata()
|
Metadata = GenerateMetadata(objectType)
|
||||||
{
|
|
||||||
MetadataType = MetadataType.Table,
|
|
||||||
MetadataTypeName = "Table",
|
|
||||||
Schema = SchemaName,
|
|
||||||
Name = TableName
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await ScriptingService.HandleScriptingScriptAsRequest(scriptingParams, requestContext.Object);
|
await ScriptingService.HandleScriptingScriptAsRequest(scriptingParams, requestContext.Object);
|
||||||
@@ -71,7 +105,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async void ScriptingScriptAsSelect()
|
public async void ScriptingScriptAsSelect()
|
||||||
{
|
{
|
||||||
await SendAndValidateScriptRequest(ScriptOperation.Select);
|
foreach (string obj in objects)
|
||||||
|
{
|
||||||
|
Assert.NotNull(await SendAndValidateScriptRequest(ScriptOperation.Select, obj));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -80,7 +117,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async void ScriptingScriptAsCreate()
|
public async void ScriptingScriptAsCreate()
|
||||||
{
|
{
|
||||||
await SendAndValidateScriptRequest(ScriptOperation.Create);
|
foreach (string obj in objects)
|
||||||
|
{
|
||||||
|
Assert.NotNull(await SendAndValidateScriptRequest(ScriptOperation.Create, obj));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -89,7 +129,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async void ScriptingScriptAsInsert()
|
public async void ScriptingScriptAsInsert()
|
||||||
{
|
{
|
||||||
await SendAndValidateScriptRequest(ScriptOperation.Insert);
|
foreach (string obj in objects)
|
||||||
|
{
|
||||||
|
Assert.NotNull(await SendAndValidateScriptRequest(ScriptOperation.Insert, obj));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -98,7 +141,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async void ScriptingScriptAsUpdate()
|
public async void ScriptingScriptAsUpdate()
|
||||||
{
|
{
|
||||||
await SendAndValidateScriptRequest(ScriptOperation.Update);
|
foreach (string obj in objects)
|
||||||
|
{
|
||||||
|
Assert.NotNull(await SendAndValidateScriptRequest(ScriptOperation.Select, obj));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -107,7 +153,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Scripting
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async void ScriptingScriptAsDelete()
|
public async void ScriptingScriptAsDelete()
|
||||||
{
|
{
|
||||||
await SendAndValidateScriptRequest(ScriptOperation.Delete);
|
foreach (string obj in objects)
|
||||||
|
{
|
||||||
|
Assert.NotNull(await SendAndValidateScriptRequest(ScriptOperation.Select, obj));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user