mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
db2 sql parser support current date & current timestamp. issue #1502
This commit is contained in:
@@ -57,6 +57,26 @@ public class DB2ExprParser extends SQLExprParser {
|
||||
return seqExpr;
|
||||
}
|
||||
}
|
||||
} else if (identifierEquals("DATE")) {
|
||||
if (expr instanceof SQLIdentifierExpr) {
|
||||
SQLIdentifierExpr identExpr = (SQLIdentifierExpr) expr;
|
||||
String ident = identExpr.getName();
|
||||
if (ident.equalsIgnoreCase("CURRENT")) {
|
||||
lexer.nextToken();
|
||||
|
||||
expr = new SQLIdentifierExpr("CURRENT DATE");
|
||||
}
|
||||
}
|
||||
} else if (identifierEquals("TIMESTAMP")) {
|
||||
if (expr instanceof SQLIdentifierExpr) {
|
||||
SQLIdentifierExpr identExpr = (SQLIdentifierExpr) expr;
|
||||
String ident = identExpr.getName();
|
||||
if (ident.equalsIgnoreCase("CURRENT")) {
|
||||
lexer.nextToken();
|
||||
|
||||
expr = new SQLIdentifierExpr("CURRENT DATE");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.primaryRest(expr);
|
||||
|
||||
Reference in New Issue
Block a user