mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
support mysql group_concat
This commit is contained in:
@@ -71,6 +71,10 @@ import com.alibaba.druid.sql.ast.statement.SQLSelectOrderByItem;
|
||||
|
||||
public class SQLExprParser extends SQLParser {
|
||||
|
||||
public final static String[] AGGREGATE_FUNCTIONS = { "AVG", "COUNT", "MAX", "MIN", "STDDEV", "SUM" };
|
||||
|
||||
protected String[] aggregateFunctions = AGGREGATE_FUNCTIONS;
|
||||
|
||||
public SQLExprParser(String sql){
|
||||
super(sql);
|
||||
}
|
||||
@@ -703,8 +707,6 @@ public class SQLExprParser extends SQLParser {
|
||||
}
|
||||
|
||||
public boolean isAggreateFunction(String word) {
|
||||
String[] aggregateFunctions = { "AVG", "COUNT", "MAX", "MIN", "STDDEV", "SUM" };
|
||||
|
||||
for (int i = 0; i < aggregateFunctions.length; ++i) {
|
||||
if (aggregateFunctions[i].compareToIgnoreCase(word) == 0) {
|
||||
return true;
|
||||
@@ -728,7 +730,9 @@ public class SQLExprParser extends SQLParser {
|
||||
aggregateExpr = new SQLAggregateExpr(methodName);
|
||||
}
|
||||
|
||||
exprList(aggregateExpr.getArguments());
|
||||
exprList(aggregateExpr.getArguments(), aggregateExpr);
|
||||
|
||||
parseAggregateExprRest(aggregateExpr);
|
||||
|
||||
accept(Token.RPAREN);
|
||||
|
||||
@@ -752,10 +756,6 @@ public class SQLExprParser extends SQLParser {
|
||||
|
||||
over.setOrderBy(parseOrderBy());
|
||||
|
||||
// if (over.getOrderBy() != null) {
|
||||
// //TODO window
|
||||
// }
|
||||
|
||||
accept(Token.RPAREN);
|
||||
aggregateExpr.setOver(over);
|
||||
|
||||
@@ -764,6 +764,10 @@ public class SQLExprParser extends SQLParser {
|
||||
return aggregateExpr;
|
||||
}
|
||||
|
||||
protected SQLAggregateExpr parseAggregateExprRest(SQLAggregateExpr aggregateExpr) {
|
||||
return aggregateExpr;
|
||||
}
|
||||
|
||||
public SQLOrderBy parseOrderBy() {
|
||||
if (lexer.token() == Token.ORDER) {
|
||||
SQLOrderBy orderBy = new SQLOrderBy();
|
||||
|
||||
Reference in New Issue
Block a user