Beispiel #1
0
        protected internal override Expression VisitSetOperator(SetOperatorExpression set)
        {
            HashSet <string> columnsUsed = allColumnsUsed.GetOrCreate(set.Alias); // a veces no se usa

            allColumnsUsed.GetOrCreate(set.Left.Alias).AddRange(columnsUsed);
            allColumnsUsed.GetOrCreate(set.Right.Alias).AddRange(columnsUsed);

            return(base.VisitSetOperator(set));
        }
Beispiel #2
0
        protected internal virtual Expression VisitSetOperator(SetOperatorExpression set)
        {
            SourceWithAliasExpression left  = (SourceWithAliasExpression)this.VisitSource(set.Left) !;
            SourceWithAliasExpression right = (SourceWithAliasExpression)this.VisitSource(set.Right) !;

            if (left != set.Left || right != set.Right)
            {
                return(new SetOperatorExpression(set.Operator, left, right, set.Alias));
            }
            return(set);
        }
Beispiel #3
0
        protected internal override Expression VisitSetOperator(SetOperatorExpression set)
        {
            SourceWithAliasExpression left  = (SourceWithAliasExpression)this.VisitSource(set.Left) !;
            SourceWithAliasExpression right = (SourceWithAliasExpression)this.VisitSource(set.Right) !;
            Alias newAlias = aliasMap.TryGetC(set.Alias) ?? set.Alias;

            if (left != set.Left || right != set.Right || newAlias != set.Alias)
            {
                return(new SetOperatorExpression(set.Operator, left, right, newAlias));
            }
            return(set);
        }
Beispiel #4
0
        protected internal override Expression VisitSetOperator(SetOperatorExpression set)
        {
            List <ColumnExpression> askedColumns = CurrentScope.Keys.Where(k => k.Alias == set.Alias).ToList();

            SourceWithAliasExpression left  = VisitSetOperatorPart(set.Left, askedColumns);
            SourceWithAliasExpression right = VisitSetOperatorPart(set.Right, askedColumns);

            CurrentScope.SetRange(askedColumns, askedColumns);

            if (left != set.Left || right != set.Right)
            {
                return(new SetOperatorExpression(set.Operator, left, right, set.Alias));
            }

            return(set);
        }
Beispiel #5
0
            protected internal override Expression VisitSetOperator(SetOperatorExpression set)
            {
                var result = (SetOperatorExpression)base.VisitSetOperator(set);

                if (this.redundant != null)
                {
                    if (result.Left is SelectExpression l)
                    {
                        this.redundant.Remove(l);
                    }

                    if (result.Right is SelectExpression r)
                    {
                        this.redundant.Remove(r);
                    }
                }

                return(result);
            }
        protected internal override Expression VisitSetOperator(SetOperatorExpression set)
        {
            VisitSetPart(set.Left);

            switch (set.Operator)
            {
            case SetOperator.Union: sb.Append("UNION"); break;

            case SetOperator.UnionAll: sb.Append("UNION ALL"); break;

            case SetOperator.Intersect: sb.Append("INTERSECT"); break;

            case SetOperator.Except: sb.Append("EXCEPT"); break;

            default:
                throw new InvalidOperationException("Unexpected SetOperator {0}".FormatWith(set.Operator));
            }

            VisitSetPart(set.Right);

            return(set);
        }
Beispiel #7
0
        protected virtual bool CompareSetOperator(SetOperatorExpression a, SetOperatorExpression b)
        {
            if (a.Operator != b.Operator)
            {
                return(false);
            }

            if (!CompareAlias(a.Alias, b.Alias))
            {
                return(false);
            }

            if (!Compare(a.Left, b.Left))
            {
                return(false);
            }

            if (!Compare(a.Right, b.Right))
            {
                return(false);
            }

            return(true);
        }
 private static IEnumerable <ColumnExpression> KeysSet(SetOperatorExpression set)
 {
     return(Keys(set.Left).Concat(Keys(set.Right)));
 }
Beispiel #9
0
 protected internal override Expression VisitSetOperator(SetOperatorExpression set)
 {
     using (Scope())
         return(base.VisitSetOperator(set));
 }
Beispiel #10
0
 protected internal override Expression VisitSetOperator(SetOperatorExpression set)
 {
     this.aliases.Add(set.Alias);
     return(base.VisitSetOperator(set));
 }