コード例 #1
0
ファイル: SqlCeLanguage.cs プロジェクト: X10sions/X10sions
 public override Expression Translate(Expression expression)
 {
     // fix up any order-by's
     expression = OrderByRewriter.Rewrite(Language, expression);
     expression = base.Translate(expression);
     expression = SkipToNestedOrderByRewriter.Rewrite(Language, expression);
     expression = OrderByRewriter.Rewrite(Language, expression);
     expression = UnusedColumnRemover.Remove(expression);
     expression = RedundantSubqueryRemover.Remove(expression);
     expression = ScalarSubqueryRewriter.Rewrite(Language, expression);
     return(expression);
 }
コード例 #2
0
            public override Expression Translate(Expression expression)
            {
                bool hasRowNumberExpression;

                // fix up any order-by's
                expression = OrderByRewriter.Rewrite(this.Language, expression);

                expression = XmlToCursorExpressionRewriter.Rewrite(expression);

                // remove redundant layers again before cross apply rewrite
                expression = UnusedColumnRemover.Remove(expression);
                expression = RedundantColumnRemover.Remove(expression);
                expression = RedundantSubqueryRemover.Remove(expression);

                expression = OneBasedIndexRewriter.Rewrite(expression);

                // convert cross-apply and outer-apply joins into inner & left-outer-joins if possible
                var rewritten = CrossApplyRewriter.Rewrite(this.language, expression);

                // convert cross joins into inner joins
                rewritten = CrossJoinRewriter.Rewrite(rewritten);

                if (rewritten != expression)
                {
                    expression = rewritten;
                    // do final reduction
                    expression = UnusedColumnRemover.Remove(expression);
                    expression = RedundantSubqueryRemover.Remove(expression);
                    expression = RedundantJoinRemover.Remove(expression);
                    expression = RedundantColumnRemover.Remove(expression);
                }

                // convert skip/take info into RowNumber pattern
                expression = SkipToRowNumberRewriter.Rewrite(expression, out hasRowNumberExpression);

                expression = SkipToNestedOrderByRewriter.Rewrite(this.Language, expression);

                expression = UnusedColumnRemover.Remove(expression);

                expression = WhereCountComparisonRewriter.Rewrite(expression);

                if (!hasRowNumberExpression)
                {
                    expression = OrderByRewriter.Rewrite(this.Language, expression);
                    expression = RedundantSubqueryRemover.Remove(expression);
                }

                expression = VfpCrossJoinIsolator.Isolate(expression);
                expression = ConditionalImmediateIfNullRemover.Remove(expression);
                expression = XmlToCursorJoinRewriter.Rewrite(expression);

                return(expression);
            }