supportnut parser

This commit is contained in:
Yako
2015-01-08 11:48:20 +08:00
parent 732258a3cf
commit e0f9048b35
4 changed files with 25 additions and 12 deletions
@@ -29,7 +29,7 @@ public class SQLAggregateExpr extends SQLExprImpl implements Serializable {
private static final long serialVersionUID = 1L;
protected String methodName;
protected Option option;
protected SQLAggregateOption option;
protected final List<SQLExpr> arguments = new ArrayList<SQLExpr>();
protected SQLOver over;
protected SQLOrderBy withinGroup;
@@ -39,7 +39,7 @@ public class SQLAggregateExpr extends SQLExprImpl implements Serializable {
this.methodName = methodName;
}
public SQLAggregateExpr(String methodName, Option option){
public SQLAggregateExpr(String methodName, SQLAggregateOption option){
this.methodName = methodName;
this.option = option;
}
@@ -64,11 +64,11 @@ public class SQLAggregateExpr extends SQLExprImpl implements Serializable {
this.withinGroup = withinGroup;
}
public Option getOption() {
public SQLAggregateOption getOption() {
return this.option;
}
public void setOption(Option option) {
public void setOption(SQLAggregateOption option) {
this.option = option;
}
@@ -153,7 +153,4 @@ public class SQLAggregateExpr extends SQLExprImpl implements Serializable {
return true;
}
public static enum Option {
DISTINCT, ALL, UNIQUE
}
}
@@ -0,0 +1,14 @@
/*
* Copyright 2015 Alibaba.com All right reserved. This software is the
* confidential and proprietary information of Alibaba.com ("Confidential
* Information"). You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement you entered
* into with Alibaba.com.
*/
package com.alibaba.druid.sql.ast.expr;
public enum SQLAggregateOption {
DISTINCT, ALL, UNIQUE
}
@@ -24,6 +24,7 @@ import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.SQLOrderBy;
import com.alibaba.druid.sql.ast.SQLOrderingSpecification;
import com.alibaba.druid.sql.ast.expr.SQLAggregateExpr;
import com.alibaba.druid.sql.ast.expr.SQLAggregateOption;
import com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr;
import com.alibaba.druid.sql.ast.expr.SQLBinaryOperator;
import com.alibaba.druid.sql.ast.expr.SQLCharExpr;
@@ -754,13 +755,13 @@ public class OracleExprParser extends SQLExprParser {
SQLAggregateExpr aggregateExpr;
if (lexer.token() == Token.UNIQUE) {
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateExpr.Option.UNIQUE);
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateOption.UNIQUE);
lexer.nextToken();
} else if (lexer.token() == (Token.ALL)) {
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateExpr.Option.ALL);
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateOption.ALL);
lexer.nextToken();
} else if (lexer.token() == (Token.DISTINCT)) {
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateExpr.Option.DISTINCT);
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateOption.DISTINCT);
lexer.nextToken();
} else {
aggregateExpr = new SQLAggregateExpr(methodName);
@@ -30,6 +30,7 @@ import com.alibaba.druid.sql.ast.SQLOrderBy;
import com.alibaba.druid.sql.ast.SQLOrderingSpecification;
import com.alibaba.druid.sql.ast.SQLOver;
import com.alibaba.druid.sql.ast.expr.SQLAggregateExpr;
import com.alibaba.druid.sql.ast.expr.SQLAggregateOption;
import com.alibaba.druid.sql.ast.expr.SQLAllColumnExpr;
import com.alibaba.druid.sql.ast.expr.SQLAllExpr;
import com.alibaba.druid.sql.ast.expr.SQLAnyExpr;
@@ -905,10 +906,10 @@ public class SQLExprParser extends SQLParser {
SQLAggregateExpr aggregateExpr;
if (lexer.token() == Token.ALL) {
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateExpr.Option.ALL);
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateOption.ALL);
lexer.nextToken();
} else if (lexer.token() == Token.DISTINCT) {
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateExpr.Option.DISTINCT);
aggregateExpr = new SQLAggregateExpr(methodName, SQLAggregateOption.DISTINCT);
lexer.nextToken();
} else {
aggregateExpr = new SQLAggregateExpr(methodName);