mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-19 17:23:55 -05:00
* Renames ShowPlan directories along with corresponding namespaces * Renames ShowPlanGraphUtils to ExecutionPlanGraphUtils * Revert "Renames ShowPlanGraphUtils to ExecutionPlanGraphUtils" This reverts commit 5dc2696ae906598447eed7360a3f342218432b83. * Reverts show plan tests name change. * Renames show plan test XML files. * Renames ported directory to ShowPlan and updates namespace accordingly
79 lines
2.7 KiB
C#
79 lines
2.7 KiB
C#
//
|
|
// Copyright (c) Microsoft. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
//
|
|
|
|
namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
|
|
{
|
|
/// <summary>
|
|
/// Parses StmtCursorType ShowPlan XML nodes
|
|
/// </summary>
|
|
internal class CursorOperationParser : XmlPlanParser
|
|
{
|
|
/// <summary>
|
|
/// Creates new node and adds it to the graph.
|
|
/// </summary>
|
|
/// <param name="item">Item being parsed.</param>
|
|
/// <param name="parentItem">Parent item.</param>
|
|
/// <param name="parentNode">Parent node.</param>
|
|
/// <param name="context">Node builder context.</param>
|
|
/// <returns>The node that corresponds to the item being parsed.</returns>
|
|
public override Node GetCurrentNode(object item, object parentItem, Node parentNode, NodeBuilderContext context)
|
|
{
|
|
return NewNode(context);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Determines Operation that corresponds to the object being parsed.
|
|
/// </summary>
|
|
/// <param name="node">Node being parsed.</param>
|
|
/// <returns>Operation that corresponds to the node.</returns>
|
|
protected override Operation GetNodeOperation(Node node)
|
|
{
|
|
object cursorOperationName = node["OperationType"];
|
|
|
|
Operation cursorOperation = cursorOperationName != null
|
|
? OperationTable.GetPhysicalOperation(cursorOperationName.ToString())
|
|
: Operation.Unknown;
|
|
|
|
|
|
return cursorOperation;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Determines node subtree cost from existing node properties.
|
|
/// </summary>
|
|
/// <param name="node">Node being parsed.</param>
|
|
/// <returns>Node subtree cost.</returns>
|
|
protected override double GetNodeSubtreeCost(Node node)
|
|
{
|
|
// This node doesn't have subtree cost, so it
|
|
// will be determined based on child nodes.
|
|
return 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Private constructor prevents this object from being externally instantiated
|
|
/// </summary>
|
|
private CursorOperationParser()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Singelton instance
|
|
/// </summary>
|
|
private static CursorOperationParser cursorOperationParser = null;
|
|
public static CursorOperationParser Instance
|
|
{
|
|
get
|
|
{
|
|
if (cursorOperationParser == null)
|
|
{
|
|
cursorOperationParser = new CursorOperationParser();
|
|
}
|
|
return cursorOperationParser;
|
|
}
|
|
}
|
|
}
|
|
}
|