TryGetNode() public méthode

public TryGetNode ( string key, MatchNode &node ) : bool
key string
node MatchNode
Résultat bool
        private void Attach(WBooleanExpression expr)
        {
            var table = _booleanTabRefVisitor.Invoke(expr);
            // Only expression who reference one table can be attached
            var tableName = table.Count == 1 ? table.First().Key : "";

            MatchEdge edge;
            MatchNode node;

            if (_graph.TryGetEdge(tableName, out edge))
            {
                if (edge.Predicates == null)
                {
                    edge.Predicates = new List <WBooleanExpression>();
                }
                edge.Predicates.Add(expr);
            }
            else if (_graph.TryGetNode(tableName, out node))
            {
                if (node.Predicates == null)
                {
                    node.Predicates = new List <WBooleanExpression>();
                }
                node.Predicates.Add(expr);
            }
            else
            {
                FailedToAssign.Add(expr);
            }
        }
Exemple #2
0
        private void Attach(WBooleanExpression expr)
        {
            var table = _bindTableVisitor.Invoke(expr, _columnTableMapping);

            MatchEdge edge, revEdge;
            MatchNode node;

            if (_graph.TryGetEdge(table, out edge))
            {
                if (edge.Predicates == null)
                {
                    edge.Predicates = new List <WBooleanExpression>();
                }
                edge.Predicates.Add(expr);

                if (_graph.ReversedEdgeDict.TryGetValue(edge.EdgeAlias, out revEdge))
                {
                    if (revEdge.Predicates == null)
                    {
                        revEdge.Predicates = new List <WBooleanExpression>();
                    }

                    // take care when an edge is using a default alias
                    var revExpr  = ObjectExtensions.Copy(expr);
                    var compExpr = revExpr as WBooleanComparisonExpression;
                    if (compExpr != null)
                    {
                        var columnExpr = compExpr.FirstExpr as WColumnReferenceExpression ?? compExpr.SecondExpr as WColumnReferenceExpression;
                        if (columnExpr != null)
                        {
                            var column = columnExpr.MultiPartIdentifier.Identifiers;
                            if (column.Count >= 2)
                            {
                                column[column.Count - 2].Value = revEdge.EdgeAlias;
                            }
                        }
                    }
                    revEdge.Predicates.Add(revExpr);
                }
            }
            else if (_graph.TryGetNode(table, out node))
            {
                if (node.Predicates == null)
                {
                    node.Predicates = new List <WBooleanExpression>();
                }
                node.Predicates.Add(expr);
            }
        }
        private void Attach(WBooleanExpression expr)
        {
            var table = _bindTableVisitor.Invoke(expr, _columnTableMapping);

            MatchEdge edge;
            MatchNode node;

            if (_graph.TryGetEdge(table, out edge))
            {
                if (edge.Predicates == null)
                {
                    edge.Predicates = new List <WBooleanExpression>();
                }
                edge.Predicates.Add(expr);
            }
            else if (_graph.TryGetNode(table, out node))
            {
                if (node.Predicates == null)
                {
                    node.Predicates = new List <WBooleanExpression>();
                }
                node.Predicates.Add(expr);
            }
        }