public override void VisitNhHavingClause(NhHavingClause havingClause, QueryModel queryModel, int index) { var visitor = new SimplifyConditionalVisitor(); havingClause.Predicate = visitor.Visit(havingClause.Predicate); // Visit the predicate to build the query var expression = HqlGeneratorExpressionVisitor.Visit(havingClause.Predicate, VisitorParameters).ToBooleanExpression(); _hqlTree.AddHavingClause(expression); }
private static void FlattenSubQuery(SubQueryExpression subQueryExpression, QueryModel queryModel) { // Move the result operator up if (queryModel.ResultOperators.Count != 0) { throw new NotImplementedException(); } var groupBy = (GroupResultOperator)subQueryExpression.QueryModel.ResultOperators[0]; queryModel.ResultOperators.Add(groupBy); foreach (var whereClause in queryModel.BodyClauses.OfType <WhereClause>().ToArray()) { //all outer where clauses actually are having clauses var clause = new NhHavingClause(whereClause.Predicate); queryModel.BodyClauses.Add(clause); queryModel.BodyClauses.Remove(whereClause); } foreach (var bodyClause in subQueryExpression.QueryModel.BodyClauses) { queryModel.BodyClauses.Add(bodyClause); } // Replace the outer select clause... queryModel.SelectClause.TransformExpressions(s => GroupBySelectClauseRewriter.ReWrite(s, groupBy, subQueryExpression.QueryModel)); foreach (var clause in queryModel.BodyClauses) { clause.TransformExpressions(s => GroupBySelectClauseRewriter.ReWrite(s, groupBy, subQueryExpression.QueryModel)); } // Point all query source references to the outer from clause queryModel.TransformExpressions(s => new SwapQuerySourceVisitor(queryModel.MainFromClause, subQueryExpression.QueryModel.MainFromClause).Swap(s)); // Replace the outer query source queryModel.MainFromClause = subQueryExpression.QueryModel.MainFromClause; }
public override void VisitNhHavingClause(NhHavingClause havingClause, QueryModel queryModel, int index) { _expander.Transform(havingClause); }
public override void VisitNhHavingClause(NhHavingClause havingClause, QueryModel queryModel, int index) { _whereJoinDetector.Transform(havingClause); }
public virtual void VisitNhHavingClause(NhHavingClause havingClause, QueryModel queryModel, int index) { }