コード例 #1
0
        /* function */

        public void HandleFunction(FunctionStatementBody node)
        {
            var outerPreviousScope = this.currentScopeRef.Current;
            var dbScope            = this.currentScopeRef.Current.GetRoot();
            var declarationScope   = dbScope.CreateChildDeclarationScope("function", dbScope.ScopeNameResolverContext);

            this.currentScopeRef.Push(declarationScope);

            // node.Analyse.OutputType
            this.ExplicitVisit((FunctionStatementBody)node);

            this.currentScopeRef.Pop();
            System.Diagnostics.Debug.Assert(ReferenceEquals(outerPreviousScope, this.currentScopeRef.Current), "previous must be restored.");
        }
コード例 #2
0
        public void ProcessFunctionStatementBody(FunctionStatementBody Function)
        {
            if (Function.Name.SchemaIdentifier == null) _smells.SendFeedBack(24, Function.Name);

            _smells.ProcessTsqlFragment(Function.ReturnType);

            if (Function.StatementList != null)
            {
                foreach (TSqlFragment Statement in Function.StatementList.Statements)
                {
                    _smells.ProcessTsqlFragment(Statement);
                }
            }
        }
コード例 #3
0
 private static Function BuildFunc(FunctionStatementBody funcExpr) =>
 new Function
 {
     Name = new[]
     {
         funcExpr.Name.DatabaseIdentifier?.Value,
         funcExpr.Name.SchemaIdentifier?.Value,
         funcExpr.Name.BaseIdentifier?.Value
     }.Where(x => x != null).ToArray(),
     Parameters = funcExpr.Parameters.ToDictionary(
         x => x.VariableName.Value,
         x => TranslateDbType(x.DataType)),
     Statements = funcExpr.StatementList,
     ReturnType = TranslateDbType(((ScalarFunctionReturnType)funcExpr.ReturnType).DataType)
 };
コード例 #4
0
        public void ProcessFunctionStatementBody(FunctionStatementBody Function)
        {
            if (Function.Name.SchemaIdentifier == null)
            {
                _smells.SendFeedBack(24, Function.Name);
            }

            _smells.ProcessTsqlFragment(Function.ReturnType);

            if (Function.StatementList != null)
            {
                foreach (TSqlFragment Statement in Function.StatementList.Statements)
                {
                    _smells.ProcessTsqlFragment(Statement);
                }
            }
        }
コード例 #5
0
 public override void ExplicitVisit(FunctionStatementBody fragment)
 {
     _fragments.Add(fragment);
 }
コード例 #6
0
 public sealed override void ExplicitVisit(FunctionStatementBody node)
 {
     base.ExplicitVisit(node);
 }
コード例 #7
0
ファイル: AllNodesVisitor.cs プロジェクト: yaakoviyun/sqlskim
 public override void ExplicitVisit(FunctionStatementBody node) { this.action(node); }