private String getDistinctExpression(MySqlCommandParser.AggregationFunctionContext ctx) { StringBuilder result = new StringBuilder(); for (int i = 3; i < ctx.ChildCount - 1; i++) { result.Append(ctx.GetChild(i).GetText()); } return(result.ToString()); }
private IASTNode CreateAggregationSegment(MySqlCommandParser.AggregationFunctionContext ctx, String aggregationType) { AggregationTypeEnum type = AggregationType.ValueOf(aggregationType.ToUpper()); int innerExpressionStartIndex = ((ITerminalNode)ctx.GetChild(1)).Symbol.StartIndex; if (null == ctx.distinct()) { return(new AggregationProjectionSegment(ctx.Start.StartIndex, ctx.Stop.StopIndex, type, innerExpressionStartIndex)); } return(new AggregationDistinctProjectionSegment(ctx.Start.StartIndex, ctx.Stop.StopIndex, type, innerExpressionStartIndex, getDistinctExpression(ctx))); }