public static string GetCheckWrapper(CustomNode node, string sqlToWrap)
    {
        string level1Type = ExtendedPropertiesHelper.GetLevel1Type(node.Type);
        string level1Name = ExtendedPropertiesHelper.GetLevel1Name(node);

        string level2Type = ExtendedPropertiesHelper.GetLevel2Type(node.Type);
        string level2Name = ExtendedPropertiesHelper.GetLevel2Name(node);

        return(GetCheckWrapper(level1Type, level1Name, level2Type, level2Name, sqlToWrap));
    }
Example #2
0
    public static int CustomNodeToIndex(DatabaseOperation databaseOperation, CustomNode node)
    {
        string level1Type = GetLevel1NodeTypeString(node.Type);
        string level1Name;
        string level2Type = GetLevel2NodeTypeString(node.Type);
        string level2Name = "";

        if (node.Type == NodeType.Database || node.Type == NodeType.Tables || node.Type == NodeType.Views || node.Type == NodeType.Programmability || node.Type == NodeType.StoredProcedures || node.Type == NodeType.Functions || node.Type == NodeType.TableValuedFunctions || node.Type == NodeType.ScalarValuedFunctions)
        {
            if (node.Type == NodeType.Database || node.Type == NodeType.Programmability || node.Type == NodeType.Functions)
            {
                level1Name = GetFirstLevel1NodeName(databaseOperation, (CustomNode)node.Nodes[0]);
            }
            else
            {
                level1Name = GetFirstLevel1NodeName(databaseOperation, node);
            }
        }
        else
        {
            if (node.Type == NodeType.TableColumns || node.Type == NodeType.TableKeys || node.Type == NodeType.TableConstraints || node.Type == NodeType.TableTriggers || node.Type == NodeType.TableIndexes || node.Type == NodeType.ViewColumns || node.Type == NodeType.ViewTriggers || node.Type == NodeType.ViewIndexes || node.Type == NodeType.StoredProcedureParameters || node.Type == NodeType.TableValuedFunctionParameters || node.Type == NodeType.ScalarValuedFunctionParameters)
            {
                level1Name = ExtendedPropertiesHelper.GetLevel1Name(node.ParentNode);
                level2Name = GetFirstLevel2NodeName(databaseOperation, node);
            }
            else
            {
                level1Name = ExtendedPropertiesHelper.GetLevel1Name(node);

                if (ExtendedPropertiesHelper.AddLevel2(node.Type))
                {
                    level2Name = ExtendedPropertiesHelper.GetLevel2Name(node);
                }
            }
        }

        int treeId = databaseOperation.GetIdFromName(level1Type, level1Name, level2Type, level2Name);

        return(treeId - 1);
    }