mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Adding plan index in file info (#1501)
This commit is contained in:
@@ -164,6 +164,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.Contracts
|
|||||||
/// File type for execution plan. This will be the file type of the editor when the user opens the graph file
|
/// File type for execution plan. This will be the file type of the editor when the user opens the graph file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GraphFileType { get; set; }
|
public string GraphFileType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Index of the execution plan in the file content
|
||||||
|
/// </summary>
|
||||||
|
public int PlanIndexInFile { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Badge
|
public class Badge
|
||||||
|
|||||||
@@ -19,14 +19,15 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan
|
|||||||
public static List<ExecutionPlanGraph> CreateShowPlanGraph(string xml, string fileName)
|
public static List<ExecutionPlanGraph> CreateShowPlanGraph(string xml, string fileName)
|
||||||
{
|
{
|
||||||
ShowPlanGraph[] graphs = ShowPlanGraph.ParseShowPlanXML(xml, ShowPlan.ShowPlanType.Unknown);
|
ShowPlanGraph[] graphs = ShowPlanGraph.ParseShowPlanXML(xml, ShowPlan.ShowPlanType.Unknown);
|
||||||
return graphs.Select(g => new ExecutionPlanGraph
|
return graphs.Select((g, index) => new ExecutionPlanGraph
|
||||||
{
|
{
|
||||||
Root = ConvertShowPlanTreeToExecutionPlanTree(g.Root),
|
Root = ConvertShowPlanTreeToExecutionPlanTree(g.Root),
|
||||||
Query = g.Statement,
|
Query = g.Statement,
|
||||||
GraphFile = new ExecutionPlanGraphInfo
|
GraphFile = new ExecutionPlanGraphInfo
|
||||||
{
|
{
|
||||||
GraphFileContent = xml,
|
GraphFileContent = xml,
|
||||||
GraphFileType = "xml"
|
GraphFileType = "xml",
|
||||||
|
PlanIndexInFile = index
|
||||||
},
|
},
|
||||||
Recommendations = ParseRecommendations(g, fileName)
|
Recommendations = ParseRecommendations(g, fileName)
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|||||||
@@ -78,10 +78,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var firstGraphSet = ShowPlanGraph.ParseShowPlanXML(requestParams.FirstExecutionPlanGraphInfo.GraphFileContent, ShowPlanType.Unknown);
|
var nodeBuilder = new XmlPlanNodeBuilder(ShowPlanType.Unknown);
|
||||||
|
var firstPlanXml = nodeBuilder.GetSingleStatementXml(requestParams.FirstExecutionPlanGraphInfo.GraphFileContent, requestParams.FirstExecutionPlanGraphInfo.PlanIndexInFile);
|
||||||
|
var firstGraphSet = ShowPlanGraph.ParseShowPlanXML(firstPlanXml, ShowPlanType.Unknown);
|
||||||
var firstRootNode = firstGraphSet?[0]?.Root;
|
var firstRootNode = firstGraphSet?[0]?.Root;
|
||||||
|
|
||||||
var secondGraphSet = ShowPlanGraph.ParseShowPlanXML(requestParams.SecondExecutionPlanGraphInfo.GraphFileContent, ShowPlanType.Unknown);
|
var secondPlanXml = nodeBuilder.GetSingleStatementXml(requestParams.SecondExecutionPlanGraphInfo.GraphFileContent, requestParams.SecondExecutionPlanGraphInfo.PlanIndexInFile);
|
||||||
|
var secondGraphSet = ShowPlanGraph.ParseShowPlanXML(secondPlanXml, ShowPlanType.Unknown);
|
||||||
var secondRootNode = secondGraphSet?[0]?.Root;
|
var secondRootNode = secondGraphSet?[0]?.Root;
|
||||||
|
|
||||||
var manager = new SkeletonManager();
|
var manager = new SkeletonManager();
|
||||||
|
|||||||
Reference in New Issue
Block a user