use file path instead of content in the request (#1562)

* use file path instead of content in the request

* remove unused using statement
This commit is contained in:
Alan Ren
2022-06-30 15:19:56 -07:00
committed by GitHub
parent 0b3c86cde8
commit 2c783a4011
2 changed files with 5 additions and 5 deletions

View File

@@ -3,7 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
{
@@ -13,9 +12,9 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
public class ParseTSqlScriptRequestParams
{
/// <summary>
/// Gets or sets the script content
/// Gets or sets the script file path.
/// </summary>
public string Script { get; set; }
public string FilePath { get; set; }
/// <summary>
/// Gets or sets the DSP.
@@ -26,7 +25,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
/// <summary>
/// Result for the ParseTSqlScript Request.
/// </summary>
public class ParseTSqlScriptResult : ResultStatus
public class ParseTSqlScriptResult
{
public bool ContainsCreateTableStatement { get; set; }
}

View File

@@ -311,9 +311,10 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
{
try
{
var script = System.IO.File.ReadAllText(requestParams.FilePath);
await requestContext.SendResult(new ParseTSqlScriptResult()
{
ContainsCreateTableStatement = DacTableDesigner.ScriptContainsCreateTableStatements(requestParams.Script, requestParams.DatabaseSchemaProvider)
ContainsCreateTableStatement = DacTableDesigner.ScriptContainsCreateTableStatements(script, requestParams.DatabaseSchemaProvider)
});
}
catch (Exception e)