mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
-11
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user