Esempio n. 1
0
 private void ProcessSetOperators(StringBuilder sb, List <ResultOperatorBase> operators)
 {
     operators.ForEach(it =>
     {
         sb.AppendLine();
         var ero = it as ExceptResultOperator;
         var iro = it as IntersectResultOperator;
         var uro = it as UnionResultOperator;
         if (ero != null)
         {
             sb.AppendLine("EXCEPT");
             sb.AppendLine(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(ero.Source2, this));
         }
         else if (iro != null)
         {
             sb.AppendLine("INTERSECT");
             sb.AppendLine(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(iro.Source2, this));
         }
         else
         {
             //TODO missing Concat operator
             sb.AppendLine("UNION ALL");
             var sqe = uro.Source2 as SubQueryExpression;
             ResultOperators.ForEach(ro =>
             {
                 if (ro is UnionResultOperator == false)
                 {
                     sqe.QueryModel.ResultOperators.Add(ro);
                 }
             });
             sb.AppendLine(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(sqe, this));
         }
     });
 }
Esempio n. 2
0
 private void ProcessSetOperators(StringBuilder sb, List <ResultOperatorBase> operators)
 {
     foreach (var it in operators)
     {
         sb.AppendLine();
         var ero = it as ExceptResultOperator;
         var iro = it as IntersectResultOperator;
         var uro = it as UnionResultOperator;
         var cro = it as ConcatResultOperator;
         if (ero != null)
         {
             sb.AppendLine("EXCEPT");
             sb.AppendLine(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(ero.Source2, this));
         }
         else if (iro != null)
         {
             sb.AppendLine("INTERSECT");
             sb.AppendLine(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(iro.Source2, this));
         }
         else
         {
             if (OrderBy.Count > 0)
             {
                 sb.Insert(0, '(');
                 sb.AppendLine(")");
             }
             SubQueryExpression sqe;
             if (uro != null)
             {
                 sb.AppendLine("UNION");
                 sqe = uro.Source2 as SubQueryExpression;
             }
             else
             {
                 sb.AppendLine("UNION ALL");
                 sqe = cro.Source2 as SubQueryExpression;
             }
             foreach (var ro in ResultOperators)
             {
                 if (ro is UnionResultOperator == false && ro is ConcatResultOperator == false)
                 {
                     sqe.QueryModel.ResultOperators.Add(ro);
                 }
             }
             sb.AppendLine(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(sqe, this));
         }
     }
 }
Esempio n. 3
0
 private void ProcessSetOperators(StringBuilder sb, List <ResultOperatorBase> operators)
 {
     operators.ForEach(it =>
     {
         sb.AppendLine();
         var ero = it as ExceptResultOperator;
         var iro = it as IntersectResultOperator;
         var uro = it as UnionResultOperator;
         var cro = it as ConcatResultOperator;
         if (ero != null)
         {
             sb.AppendLine("EXCEPT");
             sb.AppendLine(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(ero.Source2, this));
         }
         else if (iro != null)
         {
             sb.AppendLine("INTERSECT");
             sb.AppendLine(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(iro.Source2, this));
         }
         else
         {
             SubQueryExpression sqe;
             if (uro != null)
             {
                 sb.AppendLine("UNION");
                 sqe = uro.Source2 as SubQueryExpression;
             }
             else
             {
                 sb.AppendLine("UNION ALL");
                 sqe = cro.Source2 as SubQueryExpression;
             }
             //TODO if order is used, Oracle will fail anyway
             foreach (var ro in ResultOperators)
             {
                 if (ro is UnionResultOperator == false && ro is ConcatResultOperator == false)
                 {
                     sqe.QueryModel.ResultOperators.Add(ro);
                 }
             }
             sb.AppendLine(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(sqe, this));
         }
     });
 }
Esempio n. 4
0
 private string GetSqlExpression(Expression expression)
 {
     return(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(expression, QueryParts));
 }
Esempio n. 5
0
 public string GetSqlExpression(Expression expression, string contextName)
 {
     return(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(expression, this, contextName));
 }
Esempio n. 6
0
 public string GetSqlExpression(Expression expression, QueryContext context)
 {
     return(SqlGeneratorExpressionTreeVisitor.GetSqlExpression(expression, this, context));
 }