Ejemplo n.º 1
0
        public override void Visit(TableReference node)
        {
            Action <TSqlFragment> ChildCallback = delegate(TSqlFragment childNode) {
                var tabsOnLine = ColumnNumberCounter.CountTabsOnLine(childNode.StartLine, childNode.LastTokenIndex, childNode.ScriptTokenStream);
                var column     = ColumnNumberCounter.GetColumnNumberBeforeToken(tabsOnLine, childNode.ScriptTokenStream[childNode.FirstTokenIndex]);
                ErrorCallback(RULE_NAME, RULE_TEXT, childNode.StartLine, column);
            };

            var childTableJoinVisitor = new ChildTableJoinVisitor();

            node.AcceptChildren(childTableJoinVisitor);

            if (!childTableJoinVisitor.TableJoined)
            {
                return;
            }

            var childTableAliasVisitor = new ChildTableAliasVisitor(ChildCallback, CteNames);

            node.AcceptChildren(childTableAliasVisitor);
        }
Ejemplo n.º 2
0
        public override void Visit(TableReference node)
        {
            void ChildCallback(TSqlFragment childNode)
            {
                var dynamicSqlAdjustment = AdjustColumnForDymamicSQL(childNode);
                var tabsOnLine           = ColumnNumberCalculator.CountTabsBeforeToken(childNode.StartLine, childNode.LastTokenIndex, childNode.ScriptTokenStream);
                var column = ColumnNumberCalculator.GetColumnNumberBeforeToken(tabsOnLine, childNode.ScriptTokenStream[childNode.FirstTokenIndex]);

                errorCallback(RULE_NAME, RULE_TEXT, childNode.StartLine, column + dynamicSqlAdjustment);
            }

            var childTableJoinVisitor = new ChildTableJoinVisitor();

            node.AcceptChildren(childTableJoinVisitor);

            if (!childTableJoinVisitor.TableJoined)
            {
                return;
            }

            var childTableAliasVisitor = new ChildTableAliasVisitor(ChildCallback, cteNames);

            node.AcceptChildren(childTableAliasVisitor);
        }