示例#1
0
        public void SmokeTestWithVisitor()
        {
            var visitor = new TopRowFilterVisitor();
              TSqlScript script = Parse("TsqlSample1.sql");
              script.Accept(visitor);
              Assert.IsTrue(visitor.HasParenthesis);

              visitor = new TopRowFilterVisitor();
              script = Parse("TsqlSample2.sql");
              script.Accept(visitor);
              Assert.IsFalse(visitor.HasParenthesis);
        }
示例#2
0
文件: TopRule.cs 项目: numo16/SqlCop
        public override IList<RuleProblem> Analyze(RuleContext context)
        {
            TSqlScript script = context.ScriptFragment as TSqlScript;
              Debug.Assert(script != null, "TSqlScript is expected");

              Visitor = new TopRowFilterVisitor();
              script.Accept(Visitor);
              if (Visitor.WasVisited && !(Visitor as TopRowFilterVisitor).HasParenthesis)
              {
            AddProblem(Resources.TopRule);
              }

              return Problems;
        }
示例#3
0
        public override IList <RuleProblem> Analyze(RuleContext context)
        {
            TSqlScript script = context.ScriptFragment as TSqlScript;

            Debug.Assert(script != null, "TSqlScript is expected");

            Visitor = new TopRowFilterVisitor();
            script.Accept(Visitor);
            if (Visitor.WasVisited && !(Visitor as TopRowFilterVisitor).HasParenthesis)
            {
                AddProblem(Resources.TopRule);
            }

            return(Problems);
        }