GraphView.RemoveSchemanameInIdentifersVisitor.Visit C# (CSharp) Method

Visit() public method

public Visit ( WColumnReferenceExpression node ) : void
node WColumnReferenceExpression
return void
        public override void Visit(WColumnReferenceExpression node)
        {
            if (node.MultiPartIdentifier == null)
            {
                return;
            }
            var column = node.MultiPartIdentifier.Identifiers;
            var number = column.Count;
            if (number >= 3)
            {
                var tableName = column[number - 2];
                var columName = column[number - 1];
                column.Clear();
                column.Insert(0, tableName);
                column.Insert(1, columName);
            }
        }

Same methods

RemoveSchemanameInIdentifersVisitor::Visit ( GraphView.WSelectStarExpression node ) : void

Usage Example

コード例 #1
0
        /// <summary>
        /// Update FROM clause, adds DOWNSIZE predicates in the corresponding join conditions,
        /// and add corresponding predicates on the spilt nodes in the WHERE clause using 
        /// optimal component of each connected sub-graph.
        /// </summary>
        /// <param name="node">The SELECT statement</param>
        /// <param name="components">The optimal components of each fully-connected graph</param>
        private void UpdateQuery(WSelectQueryBlock node, List<MatchComponent> components)
        {
            // Removes schema name in SELECT clause and all column references.
            var removeSchemaVisitor = new RemoveSchemanameInIdentifersVisitor();
            removeSchemaVisitor.Visit(node);

            foreach (var component in components)
            {
                //// Cross apply the unmaterilized edges which point to the optimized tail nodes
                //Dictionary<MatchNode, MatchEdge> UnMatEdgeJoinDict = new Dictionary<MatchNode, MatchEdge>();
                //foreach (var unMatEdge in component.EdgeMaterilizedDict.Where(e => !e.Value).Select(e => e.Key))
                //{
                //    component.TableRef = component.SpanTableRef(component.TableRef,
                //        unMatEdge, component.GetNodeRefName(unMatEdge.SourceNode), _graphMetaData);
                //    MatchEdge joinEdge;
                //    if (UnMatEdgeJoinDict.TryGetValue(unMatEdge.SinkNode, out joinEdge))
                //    {
                //        if (!string.IsNullOrEmpty(newWhereString))
                //            newWhereString += " AND ";
                //        newWhereString += string.Format("{0}.Sink = {1}.Sink", joinEdge.EdgeAlias, unMatEdge.EdgeAlias);
                //    }
                //    else
                //    {
                //        UnMatEdgeJoinDict[unMatEdge.SinkNode] = unMatEdge;
                //    }
                //}

                // Updates from clause
                node.FromClause.TableReferences.Add(component.TableRef);
            }

            WBooleanExpression attachWhereCondition = null;
            foreach (var component in components)
            {
                attachWhereCondition = WBooleanBinaryExpression.Conjunction(attachWhereCondition,
                    component.WhereCondition);
            }

            if (attachWhereCondition != null)
            {
                if (node.WhereClause != null && node.WhereClause.SearchCondition != null)
                    node.WhereClause.SearchCondition = new WBooleanParenthesisExpression
                    {
                        Expression = node.WhereClause.SearchCondition
                    };
                else
                {
                    node.WhereClause = new WWhereClause();
                }
                node.WhereClause.SearchCondition = WBooleanBinaryExpression.Conjunction(attachWhereCondition,
                    node.WhereClause.SearchCondition);
            }
        }
All Usage Examples Of GraphView.RemoveSchemanameInIdentifersVisitor::Visit
RemoveSchemanameInIdentifersVisitor