Ejemplo n.º 1
0
        protected virtual void VisitGroupBy(IExpressionVisitor visitor, GroupByClause clause)
        {
            if (clause == null || clause.Keys.Count == 0)
            {
                return;
            }

            if (visitor.Output.Length > 0)
            {
                visitor.Output.AppendLine();
            }

            visitor.Output.Append("GROUP BY ");

            int index = 0;

            foreach (var key in clause.Keys)
            {
                if (index++ > 0)
                {
                    visitor.Output.Append(",");
                }

                visitor.Visit(key);
            }

            if (clause.Having != null)
            {
                visitor.Output.AppendLine();
                visitor.Output.Append("HAVING ");
                visitor.Visit(clause.Having);
            }
        }
Ejemplo n.º 2
0
        protected virtual void VisitGroupBy(ExpressionVisitorContext context, GroupByClause clause)
        {
            if (clause == null || clause.Keys.Count == 0)
            {
                return;
            }

            if (context.Output.Length > 0)
            {
                context.WriteLine();
            }

            context.Write("GROUP BY ");

            int index = 0;

            foreach (var key in clause.Keys)
            {
                if (index++ > 0)
                {
                    context.Write(",");
                }

                context.Visit(key);
            }

            if (clause.Having != null)
            {
                context.WriteLine();
                context.Write("HAVING ");
                context.Visit(clause.Having);
            }
        }