improved sql parser.

This commit is contained in:
wenshao
2017-10-26 11:18:54 +08:00
parent 9256b904db
commit e89063a971
21 changed files with 992 additions and 22 deletions
@@ -56,9 +56,6 @@ public class OracleCreateTableStatement extends SQLCreateTableStatement implemen
private Integer compressLevel;
private boolean compressForOltp;
private boolean onCommitPreserveRows;
private boolean onCommitDeleteRows;
private Boolean cache;
private DeferredSegmentCreation deferredSegmentCreation;
@@ -125,14 +122,6 @@ public class OracleCreateTableStatement extends SQLCreateTableStatement implemen
this.cache = cache;
}
public boolean isOnCommitPreserveRows() {
return onCommitPreserveRows;
}
public void setOnCommitPreserveRows(boolean onCommitPreserveRows) {
this.onCommitPreserveRows = onCommitPreserveRows;
}
public boolean isOnCommitDeleteRows() {
return onCommitDeleteRows;
}
@@ -801,18 +801,18 @@ public class OracleExprParser extends SQLExprParser {
over.setOrderBy(parseOrderBy());
if (over.getOrderBy() != null) {
OracleAnalyticWindowing windowing = null;
if (lexer.stringVal().equalsIgnoreCase("ROWS")) {
if (lexer.identifierEquals(FnvHash.Constants.ROWS)) {
lexer.nextToken();
windowing = new OracleAnalyticWindowing();
windowing.setType(OracleAnalyticWindowing.Type.ROWS);
} else if (lexer.stringVal().equalsIgnoreCase("RANGE")) {
} else if (lexer.identifierEquals(FnvHash.Constants.RANGE)) {
lexer.nextToken();
windowing = new OracleAnalyticWindowing();
windowing.setType(OracleAnalyticWindowing.Type.RANGE);
}
if (windowing != null) {
if (lexer.stringVal().equalsIgnoreCase("CURRENT")) {
if (lexer.identifierEquals(FnvHash.Constants.CURRENT)) {
lexer.nextToken();
if (lexer.stringVal().equalsIgnoreCase("ROW")) {
lexer.nextToken();
@@ -821,7 +821,7 @@ public class OracleExprParser extends SQLExprParser {
}
throw new ParserException("syntax error. " + lexer.info());
}
if (lexer.stringVal().equalsIgnoreCase("UNBOUNDED")) {
if (lexer.identifierEquals(FnvHash.Constants.UNBOUNDED)) {
lexer.nextToken();
if (lexer.stringVal().equalsIgnoreCase("PRECEDING")) {
lexer.nextToken();
@@ -829,6 +829,12 @@ public class OracleExprParser extends SQLExprParser {
} else {
throw new ParserException("syntax error. " + lexer.info());
}
} else {
SQLExpr expr = this.expr();
windowing.setExpr(expr);
acceptIdentifier("PRECEDING");
over.setWindowingPreceding(true);
}
over.setWindowing(windowing);
@@ -116,6 +116,10 @@ public class OracleOutputVisitor extends SQLASTOutputVisitor implements OracleAS
visit(windowing);
}
if (x.isWindowingPreceding()) {
print0(ucase ? " PRECEDING" : " preceding");
}
print(')');
return false;