mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
mysql parser support BINARY Expr
This commit is contained in:
@@ -16,7 +16,15 @@
|
||||
package com.alibaba.druid.sql.ast.expr;
|
||||
|
||||
public enum SQLUnaryOperator {
|
||||
Plus("+"), Negative("-"), Not("!"), Compl("~"), Prior("PRIOR"), ConnectByRoot("CONNECT BY"), NOT("NOT");
|
||||
Plus("+"), //
|
||||
Negative("-"), //
|
||||
Not("!"), //
|
||||
Compl("~"), //
|
||||
Prior("PRIOR"), //
|
||||
ConnectByRoot("CONNECT BY"), //
|
||||
BINARY("BINARY"), //
|
||||
RAW("RAW"), //
|
||||
NOT("NOT");
|
||||
|
||||
public final String name;
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ import com.alibaba.druid.sql.ast.expr.SQLHexExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLMethodInvokeExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLUnaryExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLUnaryOperator;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLAssignItem;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLColumnDefinition;
|
||||
@@ -160,6 +162,10 @@ public class MySqlExprParser extends SQLExprParser {
|
||||
throw new ParserException("syntax error, illegal values clause");
|
||||
}
|
||||
return this.methodRest(new SQLIdentifierExpr("VALUES"), true);
|
||||
case BINARY:
|
||||
lexer.nextToken();
|
||||
SQLUnaryExpr binaryExpr = new SQLUnaryExpr(SQLUnaryOperator.BINARY, expr());
|
||||
return primaryRest(binaryExpr);
|
||||
default:
|
||||
return super.primary();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public class MySqlLexer extends Lexer {
|
||||
|
||||
map.put("LIMIT", Token.LIMIT);
|
||||
map.put("TRUE", Token.TRUE);
|
||||
map.put("BINARY", Token.BINARY);
|
||||
|
||||
DEFAULT_MYSQL_KEYWORDS = new Keywords(map);
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ public enum Token {
|
||||
IDENTIFIED("IDENTIFIED"),
|
||||
PASSWORD("PASSWORD"),
|
||||
DUAL("DUAL"),
|
||||
BINARY("BINARY"),
|
||||
|
||||
//postgresql
|
||||
WINDOW("WINDOW"),
|
||||
|
||||
Reference in New Issue
Block a user